[mod_python] import error

Tiago Becker tiagobecker at gmail.com
Thu Aug 28 10:48:26 EDT 2008


Hello guys!

I'm new to the mod python and im trying to write a few apps but without luck
so far...

Im trying to import the module ElementTree, as follow:

import xml.etree.ElementTree as ET

and i also tried:

ET = apache.import_module('xml.etree.ElementTree')

both result in the error

MOD_PYTHON ERROR

ProcessId:      3505
Interpreter:    'python.dev.com'

ServerName:     'python.dev.com'
DocumentRoot:   '/home/becker/framework_python_web'

URI:            '/xml.py'
Location:       None
Directory:      '/'
Filename:       '/home/becker/framework_python_web/xml.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 "/home/becker/framework_python_web/xml.py", line 9, in <module>
    ET = apache.import_module('xml.etree.ElementTree', autoreload=1,
log=0, path=sys.path)

  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py",
line 304, in import_module
    return __import__(module_name, {}, {}, ['*'])

  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py",
line 991, in load_module
    return _global_modules_cache.import_module(self.__file)

  File "/usr/local/lib/python2.5/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 /home/becker/framework_python_web/xml.py.


MODULE CACHE DETAILS

Accessed:       Thu Aug 28 11:13:37 2008
Generation:     0

_mp_2aae0703a63ecf6c62424b7b7e18a76f {
  FileName:     '/home/becker/framework_python_web/xml.py'
  Instance:     1 [IMPORT]
  Generation:   0 [ERROR]
  Modified:     Thu Aug 28 11:13:32 2008
}



can somebody tell me what am i doing wrong?

Thanks a lot for your answers.

Tiago Becker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20080828/0438ad4b/attachment.html


More information about the Mod_python mailing list