Package __init__ question
Chris Liechti
cliechti at gmx.net
Thu May 23 15:39:29 EDT 2002
More information about the Python-list mailing list
Thu May 23 15:39:29 EDT 2002
- Previous message (by thread): python for webapplication tests
- Next message (by thread): Package __init__ question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"David LeBlanc" <whisper at oz.net> wrote in news:mailman.1022178791.2145.python-list at python.org: > I downloaded a package - let's call it "fumble" - and when I installed > it, it put itself into site-packages directly and not a sub-directory > of it. Since I want to keep the site-packages directory clean, I > created a subdirectory called fumble and copied all the fumble files > into it. I added an empty __init__.py file and it didn't work. Only > after I added the line "from fumble import *" to the __init__ file did > it work. did't it work with an empty __init__.py but importing "fumble.fumble" ? the import * you use is needed no get rid of the additional hiearchy level which you created throug you subdir. > Is this the correct way that packages are meant to work? I kind of > doubt it, but looking over the pythondoc failed to suggest any > alternative (my solution was a lucky guess). Comments and pointers to > good doc appreciated. i'm using something like that in my pyserial package. __init__.py decides which platform its running on and imports * from a platform dependant source file. chris -- Chris <cliechti at gmx.net>
- Previous message (by thread): python for webapplication tests
- Next message (by thread): Package __init__ question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list