Python packages - problems, pitfalls.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Tue Nov 6 06:48:55 EST 2001


>>>>> "TR" == Tim Roberts <timr at probo.com> writes:

    >> Say in b.py I do
    >> import a
    >> This will not work!

    TR> But this will:

    TR> import os os.path.append('..')  import a

    TR> That's what I've used in a similar situation.  Is that really
    TR> so horrible?  

Two problems:

    (1) os.path is a module and you can't do os.path.append.

    (2) In case you meant 'sys' and doing sys.path.append, this
    is not a good solution because now the parent dir is in the
    _global_ search path and other modules might run into bad problems
    when this happens.

prabhu




More information about the Python-list mailing list