Python's import: why doesn't it work?
dwelch91 at nospam.attbi.com
Sun Sep 29 13:51:32 EDT 2002
Jurie Horneman wrote:
> "Jurie Horneman" <jhorneman at pobox.com> wrote in message
> news:9ac02e81.0209290839.4f4d6475 at posting.google.com...
> My thanks to both of the people who have ignored my ranting and tried to
> help me. I believe I did what you suggested, but it didn't work, hence my
> Right after posting my original problem, I completely removed and
> reinstalled Python. And hey, now it works, with solution 4, ie packages as
> they are described in the documentation. I don't know what I did to my
> installation to make it do that, but my problem appears to be solved.
> For what it's worth - I've already been called on this once in a private
> email: although my post was meant to illustrate my frustration and criticism
> of the Python docs, it was also meant to be at least partly
> self-deprecatory. I should have known better: not because nobody out there
> gets that, but because text, and especially text sent out to millions of
> people, just is not a good place for irony - especially when one is asking
> for help. So if you felt offended: sorry, that wasn't what I intended.
> However, I do stand by my criticisms of the Python docs.
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:
... 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.
More information about the Python-list