Python import search path

Chris Angelico rosuav at gmail.com
Sat Aug 20 08:25:39 EDT 2011


On Sat, Aug 20, 2011 at 10:52 AM, Kevin Zhang <kevin.misc.10 at gmail.com> wrote:
> Found a few solution in python docs.
> A. sys.path.append

> I think A is not so pretty, and I don't have root  privilege to use B and C.
> So any both more elegant and practical solutions?

If, as I understand from your directory tree, ttt.py is a tester for
sss.py, then I'd say this is the right option. It's only going to be
used in the special environment of testing, so it's okay to have a
single line of code up the top that makes it convenient.

Chris Angelico



More information about the Python-list mailing list