views:

68

answers:

3

Hi, I have setup a apache2 mod_python environment with stackless python and it is working. And When I test the python environment with sys.version , it shows

2.5.2 Stackless 3.1b3 060516 (python-2.52:76701, Dec 8 2009, 02:13:34) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)]

in the browser

But when I do "import stackless" it shows :

MOD_PYTHON ERROR

ProcessId: 26177 Interpreter: '127.0.1.1'

ServerName: '127.0.1.1' DocumentRoot: '/var/www/'

URI: '/test.py' Location: None Directory: '/var/www/' Filename: '/var/www/test.py' PathInfo: ''

Phase: 'PythonHandler' Handler: 'mod_python.publisher'

Traceback (most recent call last):

  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/usr/local/lib/python2.5/site-packages/mod_python/publisher.py", line 204, in handler
    module = page_cache[req]

  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1059, in __getitem__
    return import_module(req.filename)

  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 296, in import_module
    log, import_path)

  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 680, in import_module
    execfile(file, module.__dict__)

  File "/var/www/test.py", line 1, in <module>
    import stackless

ImportError: No module named stackless

MODULE CACHE DETAILS

Accessed: Tue Dec 8 08:53:24 2009 Generation: 0

_mp_27cc55c5447f9e0aa13691719290c225 { FileName: '/var/www/test.py' Instance: 1 [IMPORT] Generation: 0 [ERROR] Modified: Tue Dec 8 08:52:43 2009 }

Also I am not able to load MySQLdb , nltk etc. All these modules can be loaded in the commandline. So my guess is some how mod_python is referring the old python installation.

What could be the issue?

A: 

mod_python is compiled against a specific version of Python, and will only call that version. You'll probably need to recompile it against Stackless, assuming that's possible.

Daniel Roseman
A: 

Hi, I have installed everything against stackless. As you can see my response for sys.version is

2.5.2 Stackless 3.1b3 060516 (python-2.52:76701, Dec 8 2009, 02:13:34) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)]

this is the response from the code

import sys def index(req): return sys.version

But when I add import stackless it thorws out the above error

import sys import stackless def index(req): return sys.version

the above code shows error

is there something that I am missing?

Devasia Joseph
A: 

Simon The sys.path returned from command line and the web output are the same. Any other suggestion?

Thank you