I am about to port my project from an development system to the production server. Everything has been prepped(servers etc). I was about to run my application on this server (you know I installed MySQL, build some chroot, installed hardening etc etc) and I got the issue of not knowing the import located at /project/src/lib. While this used to work in my Eclipse/pyDev envoirment. I did some digging around and found out pyDev sets some envoirment variables. Like PYTHON_PATH.
So, I did this aswell like so:
#!/bin/bash
PROJECT_PATH="/opt/project"
export PYTHONPATH=$PYTHONPATH:$PROJECT_PATH:$PROJECT_PATH/src:$PROJECT_PATH/static:$PROJECT_PATH/tests
python project.py
And it didn’t work. Same error, I just do not know what I should also change. Read the pyDev documention googled around althogh I bet its a common issue. I’d still like to get an answer as I can’t seem to find the answer on the net.
As a response to the Python_Path Env variable:
I am aware of that, sorry I mis-typed here..
Probably you’re setting it in the wrong place (i.e.: your script is not being called or it creates another shell with different vars).
You can check the ‘real’ PYTHONPATH in your python program by doing:
and checking if the paths are what you expect.
You can even edit the sys.path as the first thing your program does in its
__main__as that’s what python uses in the import process.