开发者

mod_python is not loading stackless Python

I have setup an 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 somehow mod_python is referring the old Python installation.

What could be the issue?


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 as below it throws the aforementioned error:

import sys
i开发者_高级运维mport stackless
def index(req):
  return sys.version

Is there something that I am missing?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜