Clodoaldo
clodoaldo.pinto.neto at gmail.com
Tue Apr 8 13:35:02 EDT 2008
2008/4/8, Joseph Bernhardt <joe at incomps.com>: > > > > > I have been having this problem for a while, but it has just recently gotten > to be enough of a bother that I thought I should figure out what's going on. > I have a simple application (myapp.py) as follows: > > > > import my_module > > import datetime > > import sys > > > > print "Hello World." > > > > Which (of course) runs fine from the interpreter. The problem is when I > start that application with the subprocess module via a separate application > through mod_python and a web request (initiate.py) as follows: > > > > import subprocess > > > > subprocess.Popen(['python myapp.py', shell=True) > > > > When myapp.py is initiated through the Popen, it is unable to locate the > my_module module and fails. When 'import my_module' is removed the > application completes fine, which leads me to believe it is a problem with > the my_module module. Since I am able to run myapp.py fine from the > interpreter rather than remotely, I was assuming that there was a > permissions problem with the module. Unfortunately, it still gave me the > same err with 777 permissions. > > > > Can anyone suggest where to go from here, please? What happens if you run this?: import sys path='/path/to/my/modules' if path not in sys.path: sys.path.append(path) import my_module import datetime import sys print "Hello World." Regards, Clodoaldo
|