Edgewall Software

Ticket #4280 (closed defect: wontfix)

Opened 3 years ago

Last modified 8 days ago

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:

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

Change History

  Changed 3 years ago by Markus Tacker <m@…>

  • status changed from new to closed
  • resolution set to invalid

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

follow-up: ↓ 6   Changed 2 years ago by eblot

  • status changed from closed to reopened
  • resolution invalid deleted
  • severity changed from normal to major

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.

follow-up: ↓ 4   Changed 2 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.

in reply to: ↑ 3   Changed 2 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 ;-)

  Changed 2 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.

in reply to: ↑ 2   Changed 16 months ago by cboos

  • status changed from reopened to closed
  • resolution set to wontfix
  • milestone 0.11.1 deleted

Replying to eblot:

... I got rid of this error when I moved the {{{ #!python 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.

  Changed 9 months 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.

  Changed 8 days ago by osimons

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

Add/Change #4280 (ImportError: No module named posixpath)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from jonas. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.