2

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
2
  • Does BB run ok in the shell? Commented Feb 24, 2015 at 5:04
  • Yes it works good from Shell when I run in browser it shows ImportError: No module named commentjson mod_python error Commented Feb 24, 2015 at 5:09

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

3 Comments

I am using sys.path.append(classpath) but still I see same issue
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
Thanks for the update I moved to swgi now itw working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.