# Having problems getting a DVR Post Processing script to run...

**URL:** <https://forums.plex.tv/t/having-problems-getting-a-dvr-post-processing-script-to-run/202618>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [August 15, 2017, 7:09pm UTC](https://forums.plex.tv/t/having-problems-getting-a-dvr-post-processing-script-to-run/202618 "2017-08-15T19:09:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![butlerm1977](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/butlerm1977/32/22454_2.png) [@butlerm1977](https://forums.plex.tv/u/butlerm1977)\
**Post date:** [August 15, 2017, 7:09pm UTC](https://forums.plex.tv/t/having-problems-getting-a-dvr-post-processing-script-to-run/202618/1 "2017-08-15T19:09:54Z")

</div>

I’m trying to create a word cloud out of subtitle text using python wordcloud\_cli.py as a component of my postprocessing script. Just a fun little test. But I cannot get the python part of it to work when executing as the plex user. I’m using CentOS 7 x64, latest version of Plex Media Server and Python 2.7.5.

Basically my script.sh is formatted like this:

```auto
#!/bin/sh
file="$1"
source="${file%.*}"
ffmpeg (code to extract subtitles and create .srt file)
python /usr/bin/wordcloud_cli.py --text /var/lib/plexmediaserver/"${source}".srt --imagefile var/lib/plexmediaserver/"${source}"_wordcloud.png --width 1280 --height 540 --margin 15

```

When I execute this script as root on the machine it works flawlessly. When I switch user using…

```auto
su - plex

```

…and execute script using “./script.sh file.ts” it works flawlessly.

But when I allow PMS to run the script from the DVR settings box and I watch the systemctl journal, I see this…

```auto
Aug 15 14:00:18 Plex.localdomain sh[2657]: Wordcloud_cli starting
Aug 15 14:00:18 Plex.localdomain sh[2657]: Could not find platform independent libraries <prefix>
Aug 15 14:00:18 Plex.localdomain sh[2657]: Could not find platform dependent libraries <exec_prefix>
Aug 15 14:00:18 Plex.localdomain sh[2657]: Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Aug 15 14:00:18 Plex.localdomain sh[2657]: ImportError: No module named site

```

I’ve made progress by inserting the following into my script…

```auto
export PYTHONPATH=/usr/lib64/
export PYTHONHOME=/usr/

```

Now when I run it, I only get…

```auto
ImportError: No module named site.

```

Any help would be greatly appreciated!!!

Mike

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [January 8, 2020, 8:04pm UTC](https://forums.plex.tv/t/having-problems-getting-a-dvr-post-processing-script-to-run/202618/2 "2020-01-08T20:04:48Z")

</div>


