#4280 closed defect (wontfix)
ImportError: No module named posixpath
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | general | Version: | devel |
Severity: | major | Keywords: | setuptools |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
In r4363 accessing any trac url:
Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 319, in send_error if self.hdf and template.endswith('.cs'): # FIXME: remove this File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 161, in __getattr__ value = self.callbacks[name](self) File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 251, in _get_hdf hdf = HDFWrapper(loadpaths=Chrome(self.env).get_all_templates_dirs()) File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 305, in get_all_templates_dirs dirs += provider.get_templates_dirs() File "build/bdist.linux-i686/egg/tracrpc/web_ui.py", line 76, in get_templates_dirs File "/usr/lib/python2.4/site-packages/setuptools-0.7a1dev_r52437-py2.4.egg/pkg_resources.py", line 16, in ? import sys, os, zipimport, time, re, imp, new, pkgutil # XXX File "/usr/lib/python2.4/os.py", line 48, in ? import posixpath as path ImportError: No module named posixpath
Attachments (0)
Change History (9)
comment:1 by , 18 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
follow-up: 6 comment:2 by , 18 years ago
Resolution: | invalid |
---|---|
Severity: | normal → major |
Status: | closed → reopened |
I don't think this issue is related to your installation.
I get the same error, and posixpath.py
does exit, and exists at the expected place (/usr/lib/python2.4/posixpath.py
on my machine)
The trouble seems to come from a conflict with setuptools. I'm not able to understand the exact issue, but AFAICT:
When XmlRpcPlugin imports resource_filename from the pkg_resources.py
file of the setuptools, the Python interpreters fails to import standard module. Again, I don't understand the exact issue, but I got rid of this error when I moved the
from pkg_resources import resource_filename
statement from the get_templates()
method up to the top of the file, along with the other import
directives.
- I'm not sure this is the right way to do, this is probably more a workaround
- I really wish a Python expert can explain why this collision -or whatever it is- occurs.
Note that this occurs with setuptools 0.6c3 and 0.7a1 - at least.
This error is not related to posixpath
, as if you disable the related code Trac will fail with other system modules that are imported from the setuptool right after the os.py
import.
I think this error can also occur with other plugin (not only XmlRpcPlugin), this is why I'm reopening this ticket on t.e.o. rather than filling a bug on TracHacks.
The code used in XmlRpcPlugin is a pretty standard code that have been duplicated in most of the plugins that relies on templates. I don't know why the error does not occur in the other plugins though. Removing the import posixpath
directive from the wiki.py
XmlRpcPlugin file does not help.
follow-up: 4 comment:3 by , 18 years ago
Keywords: | setuptools added |
---|---|
Milestone: | → 0.11 |
After reading eblot's comment, I think the issue still needs an explanation, even if we're not seeing it anymore in Trac.
comment:4 by , 18 years ago
Replying to cboos:
After reading eblot's comment, I think the issue still needs an explanation, even if we're not seeing it anymore in Trac.
Sure. I still do not understand the error BTW ;-)
comment:5 by , 18 years ago
I just encountered this error also, after upgrading FC5→FC6 and installing the setuptools RPM (and removing the egg).
The fix also works for me.
comment:6 by , 17 years ago
Milestone: | 0.11.1 |
---|---|
Resolution: | → wontfix |
Status: | reopened → closed |
Replying to eblot:
… I got rid of this error when I moved the
from pkg_resources import resource_filenamestatement from the
get_templates()
method up to the top of the file, along with the otherimport
directives.
There also have been numerous reports of similar strange import error for import statements made in methods rather than at the toplevel for MySQLdb in the past (see #4459).
More recently someone reported a similar error for rst.py concerning the docutils imports, and a similar change fixed it.
At any rate, this is a tracrpc (is that the XMLRPC plugin?) issue, and should be fixed there.
comment:7 by , 16 years ago
You are not alone. Please see After installing XML-RPC revision 2624 Trac fails with "ImportError: No module named posixpath"
comment:8 by , 16 years ago
People upgrading from 0.10.4 to 0.11.1:
You may see this because you have the old XmlRpcPlugin and/or the CtxtnavAddPlugin installed.
Disable (remove the enabling lines in trac.ini) and/or delete the plugin files (including the copy in the PYTHON_EGG_CACHE). Then try upgrading again.
Uh. My Bad. From the traceback I see that this is not related to trac but my python installation.