[Tutor] using multiple files

Gonçalo Rodrigues op73418 at mail.telepac.pt
Fri Nov 21 09:19:04 EST 2003

On Thu, 20 Nov 2003 16:44:01 -0800 (PST), you wrote:

>I am working on an application to act as a client for
>Wikipedia (see wikipedia.org for the website and
>mediawiki.org for the current php/mysql software). It
>will be based on the pywikipediabot library, which is
>split up into an annoyingly large number of files. Is
>it possible to import those modules from files that
>will be distributed with the main script, or
>preferably import from a bz2 archive?

What do you want? Do you want

import <some-module-name>

to automagically import from some files accompanying the main script?
To automagically find the relevant bz2 archive, and then load the
modules from there? 

If yes, yes you can do it. It's *not trivial* though. You may want to
read the PEP on the new import hooks. I'm trying to do something
similar, but until now I've failed. I suggest you take your questions
to comp.lang.py, since this is definitely not a trivial business -
although, if someone else on the list knows about this stuff feel free
to chime in.

Note that currently (as of 2.3) Python automagically supports import
from zip archives.

With my best regards,
G. Rodrigues

More information about the Tutor mailing list