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



On Tue, 2008-09-23 at 09:37 -0400, Willie Walker wrote:
Assuming that it is easy_install doing something not following the
correct standard

I'd opt for making this assumption and then hearing back from the easy_install 
folks when you raise the issue from them.  They are obviously far more clever 
than I am and will undoubtedly have a great answer.  :-)

I have submitted a report to the distutils-sig mailing list (where
setuptools bugs are supposed to be sent), I am still to hear back.

I have had one thought, and tried it on my system, but it does seem a
bit of a hack, although it shouldn't affect anything but orca as only
orca's launch of python will be affected by the orca bash script. In the
orca bash script where python is launched, you use a string with the -c
option, may be that string could be changed to:
/usr/bin/python -c "import sys; sys.path.insert(0,\"${ORCA_PACKAGES}\");
import orca.orca; orca.orca.main()" "$ARGS"

where ${ORCA_PACKAGES} could be the package directory of orca's
packages. This also would not need orca to be added to PYTHONPATH.

Any thoughts?

Michael Whapples

Will

, should orca find a way to ensure it puts its directory
first (hopefully in a standard way, although a non-standard way may be
the only way) at the risk it may mess up something else or should it
continue as is and rely on other software being correct (if the
assumption is correct I will report this problem to easy_install
developers).

If the above assumption is wrong and easy_install is following standard
python rules and recommendations in doing this, I would say orca needs
another way to put itself in the python module search path, as other
systems may also follow the recommendation easy_install is using here
and others could get the problem.

Michael Whapples
On Tue, 2008-09-23 at 14:19 +0100, Michael Whapples wrote:
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

_______________________________________________
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]