[mod_python] mod_python strange error

Graham Dumpleton graham.dumpleton at gmail.com
Wed May 2 18:56:31 EDT 2007


You cannot in mod_python pickle certain types of Python objects that
are located within a Python code file/module which is managed by the
mod_python module importer. See:

  http://www.dscpl.com.au/wiki/ModPython/Articles/IssuesWithSessionObjects

You will need to move the objects/types to be pickled into a normal
Python module which appears on the standard Python module search path
outside of your Apache/web application document tree.

Also, read about the import_module() method in the mod_python documentation:

  http://www.modpython.org/live/current/doc-html/pyapi-apmeth.html

This will describe other details about how the mod_python module importer works.

BTW, what have you set PythonPath to in your Apache configuration?
What you have set that to may be contributing to you getting this
specific error message when normally I would have expected to see
something else.

Graham

On 03/05/07, Gheorghe Limboi <ghitzacatalin at yahoo.com> wrote:
>
> Hi,
>
>
> can sombody tell my what can cause the error below:
>
> AssertionError: Import cycle in
> /usr/local/nav/apache/webroot/status/StatusPrefs.py.
>
>
>
> the whole output is :
>
>
> MOD_PYTHON ERROR
>
> ProcessId:      5472
> Interpreter:    'test.pknet.ro'
>
> ServerName:     'test.pknet.ro'
> DocumentRoot:   '/usr/local/nav/apache/webroot'
>
> URI:            '/status/'
> Location:       None
> Directory:      '/usr/local/nav/apache/webroot/status/'
> Filename:       '/usr/local/nav/apache/webroot/status/'
> PathInfo:       ''
>
> Phase:          'PythonHandler'
> Handler:        'status'
>
> Traceback (most recent call last):
>
>   File
> "/usr/lib/python2.4/site-packages/mod_python/importer.py",
> line 1537, in HandlerDispatch
>     default=default_handler, arg=req, silent=hlist.silent)
>
>   File
> "/usr/lib/python2.4/site-packages/mod_python/importer.py",
> line 1229, in _process_target
>     result = _execute_target(config, req, object, arg)
>
>   File
> "/usr/lib/python2.4/site-packages/mod_python/importer.py",
> line 1128, in _execute_target
>     result = object(arg)
>
>   File "/usr/local/nav/apache/webroot/status/status.py",
> line 71, in handler
>     output = indexInternal(req)
>
>   File "/usr/local/nav/apache/webroot/status/status.py",
> line 107, in indexInternal
>     prefs = HandleStatusPrefs.loadPrefs(req)
>
>   File
> "/usr/local/nav/apache/webroot/status/StatusPrefs.py", line
> 340, in loadPrefs
>     prefs = cPickle.loads(data)
>
>   File
> "/usr/lib/python2.4/site-packages/mod_python/importer.py",
> line 991, in load_module
>     return _global_modules_cache.import_module(self.__file)
>
>   File
> "/usr/lib/python2.4/site-packages/mod_python/importer.py",
> line 488, in import_module
>     assert(file != parent_info.file), "Import cycle in %s." % file
>
> AssertionError: Import cycle in
> /usr/local/nav/apache/webroot/status/StatusPrefs.py.
>
>
> Tx,
> gheorghe
>  ________________________________
> Ahhh...imagining that irresistible "new car" smell?
>  Check out new cars at Yahoo! Autos.
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>


More information about the Mod_python mailing list