Newbie namespace question

deelan ggg at zzz.it
Wed Dec 22 17:22:51 CET 2004


bcarlso at gmail.com wrote:
(...)
> 
> 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
> defined.
oh, i see. so the scenario is more complex.

> 
> Any insight would be greatly appreciated, and thanks to both deelan and
> Steve for your help.

i believe that to avoid circular refs errors remember you can 
lazy-import,  for example here i'm importing the email package:

>>> m = __import__('email')
>>> m
<module 'email' from 'C:\Python\lib\email\__init__.pyc'>

check help(__import__) for futher details.

bye.

-- 
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan" ;
foaf:weblog <http://blog.deelan.com/> .



More information about the Python-list mailing list