Re: Understanding .pth files

2011-08-28 Thread Ian Kelly
On Sat, Aug 27, 2011 at 10:42 AM, Josh English
joshua.r.engl...@gmail.com wrote:
 According to the docs, I should be able to put a file in the site-packages 
 directory called xmldb.pth pointing anywhere else on my drive to include the 
 package. I'd like to use this to direct Python to include the version in the 
 dev folder and not the site-packages folder.

The name of the .pth file is not important.  Python uses it to add
locations to sys.path; it doesn't care what packages might be
contained at those locations.

 So my C:\Python27\lib\site-packages\xmldb.pth file has one line:

 c:\dev\XmlDB\xmldb

The final xmldb is the actual package, yes?  The directory in the .pth
file should be one inside which Python can find packages, not a
package itself.  So the file should have just c:\dev\XmlDB.  Then
when you do import xmldb, Python will look inside the
c:\dev\XmlDB, find the xmldb package, and import it.


 (I've tried the slashes the other way, too, but it doesn't seem to work).

 Is the only solution to delete the installed library and add the dev folder 
 to my site.py file?

The preferred solution here is to use virtualenv to set up your
development environment without having to modify the installed version
in the system site-packages at all.

HTH,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Understanding .pth files

2011-08-27 Thread Josh English
I am developing a library for Python 2.7. I'm on Windows XP. I am also learning 
the proper way to do this (per PyPi) but not in a linear fashion: I've built  
a prototype for the library, created my setup script, and run the install to 
make sure I had that bit working properly.

Now I'm continuing to develop the library alongside my examples and 
applications that use this library.

The source is at c:\Dev\XmlDB.
The installed package in in c:\Python27\lib\site-packages\xmldb\

According to the docs, I should be able to put a file in the site-packages 
directory called xmldb.pth pointing anywhere else on my drive to include the 
package. I'd like to use this to direct Python to include the version in the 
dev folder and not the site-packages folder.

(Otherwise I have my dev folder, but end up doing actual library development in 
the site-packages folder)

So my C:\Python27\lib\site-packages\xmldb.pth file has one line:

c:\dev\XmlDB\xmldb

(I've tried the slashes the other way, too, but it doesn't seem to work).

Is the only solution to delete the installed library and add the dev folder to 
my site.py file?

Josh
-- 
http://mail.python.org/mailman/listinfo/python-list