Problems with import

Alexander Dietz Alexander.Dietz at astro.cf.ac.uk
Tue Dec 4 06:56:42 EST 2007


Aaah,

this it it! Thank you very much...

Alex

On Dec 4, 2007 11:49 AM, Diez B. Roggisch <deets at nospam.web.de> wrote:

> alexLIGO at googlemail.com wrote:
>
> > Hi,
> >
> > I have some problems when importing a library. Suppose I have a
> > directory /home/user/pythonlib/package in which I have a python-
> > library called test.py. Now I want to import that, so I put the
> > following directory into the PYTHONPATH: /home/user/pythonlib and in
> > my main python script I put:
> >
> > from package import test.
> >
> > BUT I get an error:
> >
> > ImportError: cannot import name test
> >
> > So how can I test and check what is going on, why python does not find
> > the library?
>
> Do you have this directory structure?
>
> package/__init__.py
>        test.py
>
>
> Only then (with the __init__.py in place, it can be empty) package will be
> recognized as such.
>
> Diez
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071204/8a5b242f/attachment.html>


More information about the Python-list mailing list