Strange import behavior
fredrik at pythonware.com
Fri Sep 1 19:12:31 CEST 2006
> I'm having problems importing a file into my python app. Everytime I
> try to define the object specified by this file, i.e,
> test = Test(),
> It raises an ImportError exception: ImportError: cannot import name
> I've declared it as:
> from test import Test (and I've also tried from test import *)
> As luck would have it, if I try creating a newfile (say test2) and then
> declare the same class as:
> from test2 import Test()
> It works fine!
your code samples make very little sense, and the last one isn't even
valid Python syntax.
maybe you could post a complete self-contained example (including the
file names, and what's in what file), instead of typing from memory ?
More information about the Python-list