FS#13858 - python: os.path broken
Attached to Project:
Arch Linux
Opened by Vinzent Steinberg (vks) - Wednesday, 18 March 2009, 20:01 GMT
Last edited by Allan McRae (Allan) - Thursday, 19 March 2009, 14:23 GMT
Opened by Vinzent Steinberg (vks) - Wednesday, 18 March 2009, 20:01 GMT
Last edited by Allan McRae (Allan) - Thursday, 19 March 2009, 14:23 GMT
|
Details
Description:
The essential standard Python module os.path seems to be broken. Due to this, many modules/programs are broken. Additional info: Python 2.6.1 and Python 3.0.1 Steps to reproduce: Install python. Optionally install python3 and python-matplotlib (community). Run the Python interpreter interactively and try this: $ python Python 2.6.1 (r261:67515, Dec 7 2008, 08:27:41) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.6/site-packages/matplotlib/__init__.py", line 97, in <module> import distutils.sysconfig File "/usr/lib/python2.6/distutils/sysconfig.py", line 22, in <module> PREFIX = os.path.normpath(sys.prefix) AttributeError: 'module' object has no attribute 'path' >>> import os >>> os.path Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'path' >>> import os.path >>> os.path.normpath Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'path' >>> from os.path import * >>> normpath <function normpath at 0xb7b548ec> Strangely, os.path only works when imported using the "from .. import .." syntax. |
This task depends upon
>>> import posixpath
>>> os.path = posixpath
>>> os.path.normpath
<function normpath at 0xb7b548ec>
[djgera@gerardo ~]$ python
Python 2.6.1 (r261:67515, Dec 7 2008, 08:27:41)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> import os
>>> os.path
<module 'posixpath' from '/usr/lib/python2.6/posixpath.pyc'>
also i tried to install the python3
[djgera@gerardo ~]$ python3
Python 3.0.1 (r301:69556, Feb 22 2009, 02:43:30)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path
<module 'posixpath' from '/usr/lib/python3.0/posixpath.py'>
>>>
an also works for me.
So maybe a more apropiate for this issue is a post in the forum...
> python
Python 2.6.1 (r261:67515, Dec 7 2008, 08:27:41)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> import os
>>> os.path
<module 'posixpath' from '/usr/lib/python2.6/posixpath.pyc'>
>>> import os.path
>>> os.path.normpath
<function normpath at 0xb7bb8994>
I just found the problem in my .pythonrc. To tidy up the namespace after enabling auto-completion there was the following line:
del os.path
This should be changed to "del os", otherwise os.path will be missing, even when importing os.
I'm not sure whether this is a bug to be reported upstream. What do you think?