Not Sure This Can Be Done...

gamename namesagame-usenet at yahoo.com
Wed Apr 9 17:54:18 EDT 2008


Hi,

In hopes it may help someone else, here's what I ended up doing:

1) Add this to to point to your local 'tools' directory:
           import site
           # the python tools dir is at "../../tools/python"
           site.addsitedir('..'+os.sep+'..'+os.sep+'tools'+os.sep
+'python')

2) In the 'tools' dir, there is a file called 'local.pth'.  Its
contents:
           # the individual modules are at "../../tools/python/modules/
<modulename>"
          ./modules/pexpect

3) In the script you can now do:
          import pexpect

That's it.  This works fine, but there are still 2 outstanding issues:

A) How do make the same ".pth" file usable on a win32 environment?
   The path separators are different (i.e. "/" vs "\").

B) How to auto-include any subdirectory in 'python/modules' so that
each
   new module dir doesn't have to be added manually? That is, if
package
   'foo' is added, it would be in 'python/modules/foo'. Is there a
way
   to avoid manually putting that in the '.pth'?

FYI,
-T




More information about the Python-list mailing list