Python's import: why doesn't it work?

Jurie Horneman jhorneman at pobox.com
Sun Sep 29 15:19:40 EDT 2002


"djw" <dwelch91 at nospam.attbi.com> wrote in message
news:3D973DA4.4040600 at nospam.attbi.com...
>
> Although I believe that the Python docs are a bit on the brief side
> sometimes, I don't think this topic has this problem... if you look at
> the package docs at:
>
> http://python.org/doc/current/tut/node8.html#SECTION008400000000000000000
>
> ... it has a nicely done example of a directory layout and how the
> __init__.py files fit into the picture. What I would fault the docs with
> is the fact that (having gone through this fustration myself) this
> information is not easily discoverable. How was I supposed to know that
> I needed a "package" in order to import a module from a subdirectory?
> I'm sure many would say, go buy a Python book and look there... but I
> did that, and the books aren't any better in my opinion in this area.
> This topic of importing modules from various directories has been my
> biggest fustration with the language... definitely a "wart" in my
> opinion. Don't get me wrong, discovering Python-and-All-Its-Splendor has
> changed my whole approach to software development (and made it fun
> again), but there are still a few things that could use some polish.
>

Well, like I said (admittedly not as succinctly as I might have) I found
that (after a while), tried it, and it didn't work. It now appears that
problem was related to my Python installation: after reinstallation it
worked fine.

And for what it's worth, if I didn't like Python I would have stayed with
C++ ;)

Jurie.






More information about the Python-list mailing list