Opened 12 years ago
Closed 12 years ago
#10798 closed defect (fixed)
simplemultiproject plugin crashes
Reported by: | vitali | Owned by: | falkb |
---|---|---|---|
Priority: | normal | Component: | SimpleMultiProjectPlugin |
Severity: | critical | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description
When simplemultiproject.admin.smpadminpanel is enabled I get the following traceback
Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 436, in send_error data, 'text/html') File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 808, in render_template template = self.load_template(filename, method=method) File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 768, in load_template self.templates = TemplateLoader( File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 482, in get_all_templates_dirs dirs.extend(provider.get_templates_dirs() or []) File "build/bdist.linux-x86_64/egg/simplemultiproject/admin.py", line 133, in get_templates_dirs File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 16, in ? import sys, os, zipimport, time, re, imp, new File "/usr/lib64/python2.4/os.py", line 133, in ? from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, ImportError: No module named path
Attachments (3)
Change History (27)
comment:1 follow-up: 2 Changed 12 years ago by
Owner: | changed from Christopher Paredes to falkb |
---|---|
Status: | new → assigned |
comment:2 Changed 12 years ago by
Replying to falkb:
The error happens deep down in a standard library function. I searched through the internet and have found #1536 where they found out the error happens if pydoc is not installed, which is a common requiry.
Vitali, please, could you try to install it, and then report back?
I installed epydoc.noarch 0:2.1-3.el5.rf, but it did not help. I get the same error when I enable admin panel Is there a way to add projects withou admin panel?
comment:3 Changed 12 years ago by
Well, the according code in SimpleMultiProjectPlugin is:
def get_templates_dirs(self): from pkg_resources import resource_filename return [resource_filename(__name__, 'templates')]
You could try to hack it to something like
def get_templates_dirs(self): return ['path_to_templates/templates']
or something like that. This way you avoid accessing the incompatible base library.
comment:4 follow-up: 5 Changed 12 years ago by
Vitali, this page says our problem function resource_filename()
is located in setuptools
. Have you properly installed that one?
comment:5 Changed 12 years ago by
Replying to falkb:
Vitali, this page says our problem function
resource_filename()
is located insetuptools
. Have you properly installed that one?
I re-installed setuptools
and also upgraded trac to 0.12.5, but the problem is the same
Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/Trac-0.12.5-py2.4.egg/trac/web/api.py", line 458, in send_error File "/usr/lib/python2.4/site-packages/Trac-0.12.5-py2.4.egg/trac/web/chrome.py", line 836, in render_template File "/usr/lib/python2.4/site-packages/Trac-0.12.5-py2.4.egg/trac/web/chrome.py", line 796, in load_template File "/usr/lib/python2.4/site-packages/Trac-0.12.5-py2.4.egg/trac/web/chrome.py", line 511, in get_all_templates_dirs File "build/bdist.linux-x86_64/egg/simplemultiproject/admin.py", line 133, in get_templates_dirs File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 16, in ? import sys, os, zipimport, time, re, imp, new File "/usr/lib64/python2.4/os.py", line 133, in ? from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, ImportError: No module named path
I'll try to hack get_templates_dirs
comment:6 follow-up: 7 Changed 12 years ago by
I must confess I never tried it with Python 2.4. Once I used Trac 0.12 I had Python 2.5, now I've got Trac 1.0 with Python 2.7 here.
comment:7 follow-up: 8 Changed 12 years ago by
Replying to falkb:
I must confess I never tried it with Python 2.4. Once I used Trac 0.12 I had Python 2.5, now I've got Trac 1.0 with Python 2.7 here.
I need to run trac on RHEL5 and it comes with Pyrthon 2.4. I had run Trac 0.12 without any issue on Python 2.4 until I got the one described above
comment:8 follow-up: 9 Changed 12 years ago by
Replying to vitali:
I need to run trac on RHEL5 and it comes with Pyrthon 2.4. I had run Trac 0.12 without any issue on Python 2.4 until I got the one described above
Python 2.4 is very old. I recommend at least 2.5 to you, look here how people had problems with setuptools and 2.4. In this link you can also see they use try-expect but I suspect it wouldn't help us to implement
def get_templates_dirs(self): try: from pkg_resources import resource_filename return [resource_filename(__name__, 'templates')] except ImportError: return []
because then the calling code missed the path as described here in the Trac API docs.
Changed 12 years ago by
Attachment: | Trac-milestone.jpg added |
---|
comment:9 follow-up: 10 Changed 12 years ago by
Replying to falkb:
Replying to vitali:
I need to run trac on RHEL5 and it comes with Pyrthon 2.4. I had run Trac 0.12 without any issue on Python 2.4 until I got the one described above
Python 2.4 is very old. I recommend at least 2.5 to you, look here how people had problems with setuptools and 2.4. In this link you can also see they use try-expect but I suspect it wouldn't help us to implement
def get_templates_dirs(self): try: from pkg_resources import resource_filename return [resource_filename(__name__, 'templates')] except ImportError: return []because then the calling code missed the path as described here in the Trac API docs.
Thank you very much for your quick and valuable responces.
I know that Python 2.4 is very old, and I'd gladly upgrade, but, unfortunately, it is not under my control.
Meanwhile, I replaced get_templates_dirs
with a hard-coded path as you suggested:
def get_templates_dirs(self): return ['path_to_templates/templates']
Everything works fine, except Milestones, which does not have the Project field:
comment:10 follow-ups: 11 12 Changed 12 years ago by
Replying to vitali:
Everything works fine, except Milestones, which does not have the Project field:
As explained on wiki:SimpleMultiProjectPlugin#Example (Look for "Associate a milestone in a project"), you must use the Roadmap page to attach milestones to projects. Currently, there appropriate code for extending the pages in the Admin panel.
comment:11 Changed 12 years ago by
Replying to falkb:
Currently, there appropriate code ...
Typo. Should be "Currently, there aint no appropriate code ..."
comment:12 follow-up: 13 Changed 12 years ago by
As explained on wiki:SimpleMultiProjectPlugin#Example (Look for "Associate a milestone in a project"), you must use the Roadmap page to attach milestones to projects. Currently, there appropriate code for extending the pages in the Admin panel.
Everyhing works
Thank you very much for your help!!!
comment:13 Changed 12 years ago by
Replying to anonymous:
Thank you very much for your help!!!
You're welcome. The problem still exists, that's why I think I keep this ticket open. Meanwhile I asked on the Trac development mailing-list
comment:14 follow-up: 15 Changed 12 years ago by
Reproduced. I checked log/trac.log
and consider that simplemultiproject/version.py has two problems.
- Syntax error at
... if ... else ...
with Python 2.4 - Import Error at
import user_time
with Trac 0.12.x
The following patch would be simple to remove using user_time
.
-
simplemultiproject/version.py
7 7 from simplemultiproject.model import * 8 8 9 9 #trac 10 from trac import __version__ as VERSION11 10 from trac.attachment import AttachmentModule 12 11 from trac.config import ExtensionOption 13 12 from trac.core import * … … 23 22 get_datetime_format_hint, format_date, \ 24 23 format_datetime, from_utimestamp 25 24 26 if VERSION > '0.12':27 from trac.util.datefmt import user_time28 29 25 from trac.web.api import IRequestHandler, IRequestFilter, ITemplateStreamFilter 30 26 from trac.web.chrome import add_link, add_notice, add_script, add_stylesheet, \ 31 27 add_warning, Chrome, INavigationContributor … … 229 225 230 226 if 'time' in req.args: 231 227 time = req.args.get('time', '') 232 if VERSION <= '0.12': 233 version.time = time and parse_date(time, req.tz, 'datetime') or None 228 if time: 229 version.time = parse_date(time, tzinfo=req.tz, 230 locale=req.locale, hint='datetime') 234 231 else: 235 version.time = user_time(req, parse_date, time, hint='datetime') if time elseNone232 version.time = None 236 233 else: 237 234 version.time = None 238 235
comment:15 follow-up: 16 Changed 12 years ago by
Replying to jun66j5:
Reproduced. I checked
log/trac.log
and consider that simplemultiproject/version.py has two problems.
jun66j5, are you sure this is the right ticket? Your patch is for version.py though vitali reported a problem in admin.py. Second, your patch would revert [12453] which was a necessary port to make it work with Trac 1.0. What was the traceback in your case? Nevertheless thanks a lot for your attention to this problem here.
Changed 12 years ago by
Attachment: | 0.12-t10798-trac.log added |
---|
comment:16 Changed 12 years ago by
Replying to falkb:
jun66j5, are you sure this is the right ticket? Your patch is for version.py though vitali reported a problem in admin.py.
Right. If failed on loading a plugin, import pkg_resouces.resource_filename
failed. See attachment:0.12-t10798-trac.log.
Second, your patch would revert [12453] which was a necessary port to make it work with Trac 1.0. What was the traceback in your case?
If you want to work with Trac 0.12, it shouldn't use user_time
.
Also, that code
user_time(req, parse_date, time, hint='datetime')
works as the following with Trac 0.12 compatibility.
parse_date(time, tzinfo=req.tz, locale=req.locale, hint='datetime')
comment:17 Changed 12 years ago by
In addition, the check of Trac version is wrong. When Trac is 0.12.1 or later, that code will import user_time
.
if VERSION > '0.12': from trac.util.datefmt import user_time
I think that it should be the following in that case.
try: from trac.util.datefmt import user_time except ImportError: # if not needed, user_time = None def user_time(req, func, *args, **kwargs): """porting from 1.0-stable""" ...
comment:18 follow-ups: 19 20 Changed 12 years ago by
Hi jun66j5,
Replying to jun66j5:
Replying to falkb:
jun66j5, are you sure this is the right ticket? Your patch is for version.py though vitali reported a problem in admin.py.
Right. If failed on loading a plugin,
import pkg_resouces.resource_filename
failed. See attachment:0.12-t10798-trac.log.
Double-check: Do I understand right, that import error in admin.py is a subsequent error of a syntax error in version.py? And your patch includes the fix for admin.py as well?
If you want to work with Trac 0.12, it shouldn't use
user_time
.
Does it mean, your patch in 14 works for 0.12 _and_ 1.0?
comment:19 Changed 12 years ago by
Double-check: Do I understand right, that import error in admin.py is a subsequent error of a syntax error in version.py? And your patch includes the fix for admin.py as well?
I did not connect it to the fail in admin.py
, but I did see an error while compiling version.py
byte-compiling build/bdist.linux-x86_64/egg/simplemultiproject/version.py to version.pyc File "build/bdist.linux-x86_64/egg/simplemultiproject/version.py", line 235 version.time = user_time(req, parse_date, time, hint='datetime') if time else None ^ SyntaxError: invalid syntax
Changed 12 years ago by
Attachment: | t10798-2.diff added |
---|
comment:20 follow-up: 22 Changed 12 years ago by
Sorry. I've mistaken. New patch is here, t10798-2.diff.
Double-check: Do I understand right, that import error in admin.py is a subsequent error of a syntax error in version.py? And your patch includes the fix for admin.py as well?
Yes. The issue for admin.py
is caused by SyntaxError
and ImportError
in version.py
. The patch does NOT include any changes for admin.py
, but it's right.
If you want to work with Trac 0.12, it shouldn't use
user_time
.Does it mean, your patch in 14 works for 0.12 _and_ 1.0?
I tested with t10798-2.diff on Trac 0.12 and 1.0.
Vitali, could you please try the latest patch?
comment:21 follow-up: 23 Changed 12 years ago by
comment:22 Changed 12 years ago by
Vitali, could you please try the latest patch?
t10798-2.diff works for me on Trac 0.12-5 with Python 2.4
Thank you very much
comment:23 follow-up: 24 Changed 12 years ago by
I also checked out [12535] to test, but when I tried to generate plugin .egg by running python setup.py bdist_egg
I got:
Traceback (most recent call last): File "setup.py", line 21, in ? entry_points = {'trac.plugins': ['simplemultiproject = simplemultiproject']} File "/usr/lib64/python2.4/distutils/core.py", line 149, in setup dist.run_commands() File "/usr/lib64/python2.4/distutils/dist.py", line 946, in run_commands self.run_command(cmd) File "/usr/lib64/python2.4/distutils/dist.py", line 966, in run_command cmd_obj.run() File "/usr/lib/python2.4/site-packages/setuptools/command/bdist_egg.py", line 167, in run self.run_command("egg_info") File "/usr/lib64/python2.4/distutils/cmd.py", line 333, in run_command self.distribution.run_command(command) File "/usr/lib64/python2.4/distutils/dist.py", line 966, in run_command cmd_obj.run() File "/usr/lib/python2.4/site-packages/setuptools/command/egg_info.py", line 171, in run self.find_sources() File "/usr/lib/python2.4/site-packages/setuptools/command/egg_info.py", line 252, in find_sources mm.run() File "/usr/lib/python2.4/site-packages/setuptools/command/egg_info.py", line 306, in run self.add_defaults() File "/usr/lib/python2.4/site-packages/setuptools/command/egg_info.py", line 333, in add_defaults rcfiles = list(walk_revctrl()) File "/usr/lib/python2.4/site-packages/setuptools/command/sdist.py", line 45, in walk_revctrl for item in ep.load()(dirname): File "/usr/lib/python2.4/site-packages/setuptools/command/sdist.py", line 52, in _default_revctrl for path in finder(dirname,path): File "/usr/lib/python2.4/site-packages/setuptools/command/sdist.py", line 98, in entries_finder log.warn("unrecognized .svn/entries format in %s", dirname) NameError: global name 'log' is not defined
comment:24 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Replying to vitali: ...
File "/usr/lib/python2.4/site-packages/setuptools/command/sdist.py", line 98, in entries_finder
log.warn("unrecognized .svn/entries format in %s", dirname)
NameError: global name 'log' is not defined
Well, this is a known problem with a bad constellation of old versions of setuptool and svn. I've found some workarounds and tricks making it work somehow. I understood it as if setuptool has a little bug that bites you there. Just ask more here, if it doesn't work for you, maybe we can help you then.
Anyway, the actual problem is confirmed to be solved. Thanks a lot jun66j5.
The error happens deep down in a standard library function. I searched through the internet and have found #1536 where they found out the error happens if pydoc is not installed, which is a common requiry.
Vitali, please, could you try to install it, and then report back?