Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#19114 - [openoffice-base] profile modifies Python behaviour

Attached to Project: Arch Linux
Opened by Hervé (herve) - Thursday, 15 April 2010, 14:21 GMT
Last edited by Andreas Radke (AndyRTR) - Tuesday, 01 June 2010, 10:08 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Andreas Radke (AndyRTR)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
The profile script "openoffice.sh" modifies the Python path:

export PYTHONPATH=$PYTHONPATH:/usr/lib/openoffice/basis-link/program/

But when PYTHONPATH is empty, this results in:

:/usr/lib/openoffice/basis-link/program/

That empty entry makes Python always add the current working directory to the path:

~ $ python -c "import os, sys; print os.getcwd() in sys.path"
True
~ $ cd /tmp
/tmp $ python -c "import os, sys; print os.getcwd() in sys.path"
True

This provokes side effects when there's a module in the current working directory whose name conflicts with a module in the standard library:

Traceback (most recent call last):
File "../bin/ipkg-build.py", line 30, in <module>
import itools.gettext
File "/home/herve/Itaapy/LpOD/lib/python2.6/site-packages/itools/gettext/__init__.py", line 22, in <module>
from mo import MOFile
File "/home/herve/Itaapy/LpOD/lib/python2.6/site-packages/itools/gettext/mo.py", line 19, in <module>
from gettext import GNUTranslations
File "/home/herve/Itaapy/LpOD/itools--lpod/gettext/__init__.py", line 22, in <module>
from mo import MOFile
File "/home/herve/Itaapy/LpOD/itools--lpod/gettext/mo.py", line 19, in <module>
from gettext import GNUTranslations
ImportError: cannot import name GNUTranslations

Inside my "gettext" package, I import "gettext" from the standard library, but then it's just trying to import itself again.

If I remove the ":", it works as expected:

$ export PYTHONPATH=/usr/lib/openoffice/basis-link/program/

So my suggestion is not to reuse $PYTHONPATH if not defined.

Additional info:
* package version(s)

3.2.0-3
This task depends upon

Closed by  Andreas Radke (AndyRTR)
Tuesday, 01 June 2010, 10:08 GMT
Reason for closing:  Fixed
Comment by Andreas Radke (AndyRTR) - Saturday, 24 April 2010, 11:24 GMT
Try. That should solve it.

export PYTHONPATH=/usr/lib/openoffice/basis-link/program/:$PYTHONPATH
Comment by Hervé (herve) - Sunday, 25 April 2010, 13:22 GMT
It's not a problem of order. I guess Python is splitting on ":" so it gives ['/usr/lib/...', ''], and then it should resolve the current path against each item.
Comment by Andreas Radke (AndyRTR) - Monday, 31 May 2010, 17:05 GMT
we comment it out from the next release on. user may enable it ot not if wanted. should be solved then for you.
Comment by Hervé (herve) - Tuesday, 01 June 2010, 07:13 GMT
Thanks.

Loading...