-
Notifications
You must be signed in to change notification settings - Fork 541
PYTHONPATH needs to be exported #2
Comments
That's weird. It works when I try it. Does this depends on the system? |
Mine also needs to export PYTHONPATH, otherwise I get this error: I'm using Python 3.4.3 on OSX Yosemite. |
Maybe it's an issue with Macs? Unfortunately, I don't have any to test on. |
no, it's bash (I'm on linux), you need to explicitly export or put on the exec command line, you may already have set |
I'm using Python 3.4.3 on OSX 10.10.3 |
It looks like I have PYTHONPATH set to /usr/local/buildtools/current/sitecustomize, but I can't imagine how that would make a difference. It's weird that on your system you have to explicitly export it, while on mine, merely setting it seems to be enough. |
Are you running from the enjarify directory or somewhere else and using a symlink? |
I'm running from elsewhere using a symlink. Anyway, I went ahead and added export. Does it work now? |
Working for me. :) |
Well, the output of
prints |
readlink doesn't work for me, too. my OS version is Mac OSX 10.11; I change it to this:
And it worked for me. |
Copy the following to enjarify.sh, you can solve this problem. good luck.function guess {
if [ -z "$PYTHON" ]; then
result=$($1 -c "print(range)" 2>/dev/null)
if [ "$result" = "<class 'range'>" ]; then
PYTHON=$1
fi
fi
}
guess "pypy3"
guess "python3"
guess "pypy"
guess "python"
#Gets the root path of the current script
getCurrentShellRootPath()
{
oldPath=`pwd`
SOURCE="$1"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR2="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo ${DIR2}
cd $oldPath
}
if [ -z "$PYTHON" ]; then
echo "Unable to find python3 on path"
else
echo "Using $PYTHON as Python interpreter"
# Find location of this bash script, and set its directory as the PYTHONPATH
#export PYTHONPATH=$(dirname "$(readlink "${BASH_SOURCE[0]}")")
#Modify the path to PYTHONPATH
shellRootPath=`getCurrentShellRootPath $0`
export PYTHONPATH=${shellRootPath}
# Now execute the actual program
exec $PYTHON -O -m enjarify.main "$@"
fi |
it worked! Thanks! |
Try this, |
I have tried on macOS Mojave and the script works as expected. |
runtests: drop -Xss param
the .sh script does not export PYTHONPATH, you need to export it using
export PYTHONPATH
or prepending it to exec callThe text was updated successfully, but these errors were encountered: