Python20 and .pth files

Thomas Heller thomas.heller at ion-tof.com
Thu Feb 15 08:43:22 CET 2001


"Mark Hammond" <MarkH at ActiveState.com> wrote in message news:3A8B01F3.1000605 at ActiveState.com...
> greg Landrum wrote:
>
>
> > However... one of the applications I'm working on creates Python COM
> > servers which import Numeric.  These work fine when I call them from Python
> > applications (so none of my unit tests broke when I upgraded to 2.0, so I
> > never noticed the problem).  However, when I create one of these COM
> > objects from within VB, I get an ImportError for Numeric.  After much
> > shrieking and pulling of my hair (I'm giving a demo of these objects on
> > Friday, so I was not pleased to discover that they were mysteriously
> > broken), I worked out a solution: add c:/Python20/Numeric to my PYTHONPATH
> > environment variable.  Now everything is happy.
>
> I believe this is a problem in certain embedding situations.  Specifically, I believe it is because Python does not know its
"home", so doesnt know where to load the .pth files from.

Are you sure site.py is imported at all? There PYTHONPATH is extended by the contents
of the .pth files.

>
> > The Question:
> > Was it an accident that everything just worked before or has something
> > changed?  I know old versions of Numeric used to have an installer that may
> > or may not have set registry keys to help out with this problem.
> > Are .pth files being deprecated so that we (the users) should start
> > badgering developers who still ship modules requiring them?
>
> I dont believe this would ever have worked.  As you suggest, it is quite possible that only new versions of Numeric have .pth
files.
>
New versions have a .pth file (since they are distributed via distutils),
old versions used registry settings.

> This is on my "to-do" list - having Python know its correct home in embedded situations would solve a few other problems too.
>
This is a bug in getpathp.c, see
http://sourceforge.net/bugs/?func=detailbug&bug_id=131064&group_id=5470


> Mark.
>
Mark, please look at the bug. Otherwise you are forcing my to submit a patch ;-)

Thomas





More information about the Python-list mailing list