Page 1 of 1
post processing on OS X with python script
Posted: January 16th, 2010, 6:26 am
by imthenachoman
I am having trouble running a python post processing script. Right now my script is simple:
Code: Select all
#!/usr/bin/python2.6
import sys
import plistlib
Here is the error:
'import site' failed; use -v for traceback
...(cut for brevity)...
ImportError: No module named plistlib
The program works fine when run via CLI.
I have even tried a wrapper script:
Code: Select all
#!/bin/bash
SCRIPT_DIR=`dirname "$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"`
/usr/bin/python2.6 $SCRIPT_DIR/to_iphone.py "$@"
But I get the same error.
I am on beta6 but I had the same problem with beta5.
Re: post processing on OS X with python script
Posted: January 31st, 2010, 2:41 am
by zerointerupt
I'm having the same troubles with a different script. Is it a problem with our python path? I've checked my path in the python interpreter using sys.path and it seems to be point towards 2.6.
Does anyone have any ideas? I've seen quite a few posts from people having this problem on their Macs but no solutions.
Re: post processing on OS X with python script
Posted: January 31st, 2010, 6:21 am
by imthenachoman
Yeah it has something to do with the PATH that SabNZBD uses. I'm finding the path for all my modules and adding them to the path for SabNZBD.
Re: post processing on OS X with python script
Posted: February 1st, 2010, 6:35 pm
by imthenachoman
Re: post processing on OS X with python script
Posted: February 1st, 2010, 7:22 pm
by Camelot
cool. I will give your fix a try, and post back if it works for my script.
Edit: works like a charm. thanks! Been annoyed for a month about that "bug"
Re: post processing on OS X with python script
Posted: February 15th, 2010, 3:41 pm
by shypike
It looks like this something Snow Leopards Python causes.
The app is built on Snow Leopard.
The script gets the wrong PYTHONPATH and PYTHONHOME environment variables,
the ones of the "embedded" Python.
I'm not sure we can fix this.
There is a work-around possible.
You'll need to make a wrapper script:
Code:
#!/bin/sh
unset PYTHONPATH
unset PYTHONHOME
/full-path-to-your/python-script.py $*
Re: post processing on OS X with python script
Posted: February 18th, 2010, 9:07 pm
by rAf
I've found another way to make it works.
Just add "-E" to your python scripts shebang like this :
No need to make a wrapper or mod sys.path anymore.
Re: post processing on OS X with python script
Posted: February 21st, 2010, 5:47 pm
by zakharm
great find rAf!