Re: [orca-list] Problem with PYTHONPATH and multiple versions of orca



I shall try and describe what is happening (or what appears to be
happening).

According to site.py in my /usr/lib/python2.5/ directory you may specify
package path configuration files. These path configuration files are
named in the form <package>.pth and list the paths which should be added
to the python module path. See site.py for full details.

I have setuptools installed and part of it is easy_install. It seems
like any package installed using easy_install adds the packages
directory to easy-install.pth. In this file I found a line
specifying /usr/lib/python2.5/site-packages (my standard python module
path). When running python in interactive mode, it appears that the
directories from easy-install.pth were being added before the content of
PYTHONPATH (achieved by examining sys.path).

I believed that PYTHONPATH was always meant to be the first path
searched, but it appears not. I am wondering, I did see in
easy-install.pth some other code other than the paths, if so this may be
something which is causing this behaviour, and in my mind is wrong.

From reading that bug report you pointed me to it doesn't appear to be
that. I hope the information in this email makes things clear.

Michael Whapples
On Tue, 2008-09-23 at 08:48 -0400, Willie Walker wrote:
I'm not quite sure I understand how this stuff is actually getting in 
the way.  My understanding is that PYTHONPATH should be considered 
first.  Is it possible that PYTHONPATH has been defined in your local 
environment?  The orca script adds itself to the end of the PYTHONPATH 
environment variable, so if you have PYTHONPATH set up already, it 
might end up picking up that.  As for why orca adds itself to the end 
rather than the beginning, see 
http://bugzilla.gnome.org/show_bug.cgi?id=491417.   

Will

On Sep 23, 2008, at 7:32 AM, Michael Whapples wrote:

Hello,
I recently noticed that my trunk build of orca was not being used. The
trunk build was in a custom location, and I had orca 2.22.3 from my
distro installed in the standard place.

After some looking, I realised the following: although the correct orca
bash script was being run, it was importing from the standard python
site-packages directory so using the distro's orca python files. 
Further
examination of the system revealed that easy_install from setuptools 
had
added the python site-packages directory to its pth file, so this meant
that the standard site-packages directory was searched for modules
before the custom orca directory which is specified in the PYTHONPATH
environment variable set by the orca script.

I have solved this manually by removing the standard site-packages
directory from the easy-install.pth file, but the question is what can
be done so that orca shouldn't suffer from this again?

Should setuptools (or any other package) add the standard site-packages
directory to their .pth files (I feel the correct answer but relies on
others being correct). Alternatively is there any way orca could ensure
that its custom directory is the first on the packages path as this
shows that PYTHONPATH can fail to do this.

Michael Whapples

_______________________________________________
Orca-list mailing list
Orca-list gnome org
http://mail.gnome.org/mailman/listinfo/orca-list
Visit http://live.gnome.org/Orca for more information on Orca





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]