Graham Dumpleton
grahamd at dscpl.com.au
Sat May 14 00:39:00 EDT 2005
On 14/05/2005, at 1:34 PM, Wouter van Marle wrote: > Hi all, > > The problems importing my modules are solved, using the following > statement, as suggested by Graham: > > import os > directory = os.path.split(__file__)[0] > main = apache.import_module("main",path=[directory]) > > > The simpler version: > > main = apache.import_module("main") > > suffers from loss of the module; apparently the current path of the > file > that's being run, is not added to syspath like what happens in normal > python programs. This was unexpected to me. It is added to sys.path, but only for the actual directory for which PythonHandler is defined. Thus, if file was in a subdirectory, it wouldn't be found. If you define PythonPath explicitly, this can also prevent it being added to sys.path. Graham
|