Newbie namespace question
jeff at ccvcorp.com
Wed Dec 22 20:02:27 CET 2004
bcarlso at gmail.com wrote:
>Now, in jdbc.py I have
>def __init__(self, servername):
>self.servername = servername
>def create(name, connectionInfo, etc):
>#Call the IBM supplied WebSphere config object
>Run it and get a name error, which, makes sense.
>If I try to use the standard import solution as deelan suggests I have
>a circular reference on the imports and I get an error that it can't
>import class DataSource (presumbably because it hasn't gotten far
>enough through jdbc.py to realize that there's a DataSource class
How about you try this?
def create(name, connectionInfo, ...):
from configure_server_foo import AdminConfig
This way, jdbc.py won't try to import configure_server.foo until
create() is called. By deferring that import, you should be able to
avoid the circular import problem...
More information about the Python-list