Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

Hi I am using mod_python and I have a python module AA in a directory X and in directory X I have sub directories which has other modules which are imported in AA. I am importing AA in BB. when I run BB it fails to load modules imported in AA.

It's a python path issue, but the issue is how to dynamically set the path to the users workspace.

the workspace differs for each users.

Please help me on this.

to update I am using

sys. path.append(classpath)

in my BB script but still it fails.

my vhost file has following added in Directory tag :

AddHandler cgi-script .py
PythonHandler mod_python
PythonDebug On
share|improve this question
    
Does BB run ok in the shell? – PM 2Ring Feb 24 at 5:04
    
Yes it works good from Shell when I run in browser it shows ImportError: No module named commentjson mod_python error – user954299 Feb 24 at 5:09

1 Answer 1

up vote 0 down vote accepted

Python path can be added using the PythonPath directive. It should work in the server, virtual host, directory and .htaccess contexts.

PythonPath "['/path/to/site1', '/path/to/site2']"

http://modpython.org/live/current/doc-html/directives.html#pythonpath

share|improve this answer
    
I am using sys.path.append(classpath) but still I see same issue – user954299 Feb 24 at 17:14
    
You have to post some code before I can try to help you. How are you appending path? Also, take a look at this question stackoverflow.com/questions/1893598/pythonpath-vs-sys-path – Boris Feb 25 at 0:51
    
Thanks for the update I moved to swgi now itw working – user954299 Feb 26 at 17:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.