Edgewall Software
Modify

Opened 8 years ago

Closed 7 years ago

Last modified 5 years ago

#4280 closed defect (wontfix)

ImportError: No module named posixpath

Reported by: Markus Tacker <m@…> Owned by: jonas
Priority: normal Milestone:
Component: general Version: devel
Severity: major Keywords: setuptools
Cc:
Release Notes:
API 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 Changed 8 years ago by Markus Tacker <m@…>

  • Resolution set to invalid
  • Status changed from new to closed

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

comment:2 follow-up: Changed 8 years ago by eblot

  • Resolution invalid deleted
  • Severity changed from normal to major
  • Status changed from closed to 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.

  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 follow-up: Changed 8 years ago by cboos

  • Keywords setuptools added
  • Milestone set to 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 in reply to: ↑ 3 Changed 8 years ago by eblot

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 Changed 8 years ago by russell@…

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 in reply to: ↑ 2 Changed 7 years ago by cboos

  • Milestone 0.11.1 deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

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 Changed 6 years ago by anonymous

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 Changed 5 years ago by osimons

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.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from jonas 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.