Edgewall Software
Modify

Opened 17 years ago

Closed 16 years ago

Last modified 15 years ago

#4280 closed defect (wontfix)

ImportError: No module named posixpath

Reported by: Markus Tacker <m@…> 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 Markus Tacker <m@…>, 17 years ago

Resolution: invalid
Status: newclosed

Uh. My Bad. From the traceback I see that this is not related to trac but my python installation.

comment:2 by Emmanuel Blot, 17 years ago

Resolution: invalid
Severity: normalmajor
Status: closedreopened

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.

  1. I'm not sure this is the right way to do, this is probably more a workaround
  2. 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.

comment:3 by Christian Boos, 17 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.

in reply to:  3 comment:4 by Emmanuel Blot, 17 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 russell@…, 17 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.

in reply to:  2 comment:6 by Christian Boos, 16 years ago

Milestone: 0.11.1
Resolution: wontfix
Status: reopenedclosed

Replying to eblot:

… 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.

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:8 by anonymous, 15 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.

comment:9 by osimons, 15 years ago

BTW, this is now fixed for th:XmlRpcPlugin in th:changeset:6106.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.