[mod_python] Module importing and classes

Graham Dumpleton graham.dumpleton at gmail.com
Thu Mar 27 15:51:50 EDT 2008


Does webGUI.py try and import webEdit and thus you have a circular import?

With PythonDebug On in configuration, what is the import dependency
graph information that is included in HTTP error page response after
the trace back information?

Graham

On 28/03/2008, Dominique.Holzwarth at ch.delarue.com
<Dominique.Holzwarth at ch.delarue.com> wrote:
> Hello everyone
>
>  I'm trying to import class definitions from different modules but getting some errors...
>
>  Lets say I have the folloing structure:
>
>  Python/
>         GUI/
>                 webGUI.py
>                 Edit/
>                         webEdit.py
>
>  Inside webGUI.py there's a class 'WebGUI' and inside 'webEdit.py' there's a class 'WebEdit' that inherits from 'WebGUI'.
>  'webEdit.py' looks like this:
>
>  webEdit.py
>  *****************************************************
>  from mod_python import apache
>  webGUI = apache.import_module('~/GUI/webGUI.py')
>  class WebEdit(webGUI.WebGUI):
>
>     def __init__(self):
>         pass
>  *****************************************************
>
>  When I run my application I get the followin error:
>
>  File "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\python\GUI\Edit\webEdit.py", line 3, in <module>
>     class WebEdit(webGUI.WebGUI):
>
>  AttributeError: 'module' object has no attribute 'WebGUI'
>
>  If I omit the 'webGUI' in the class definition of 'WebEdit' I get an error stating that 'the global name "WebGUI" is not defined' ...
>
>  So basicly I need to know how to inherit from classes which are defined in another module (which is in another folder) under mod_python... :-)
>
>  Sorry for the recently spam, this is my first web application with mod_python & apache :-/
>
>  Greetings
>  Dominique
>
>
>  _______________________________________________
>  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