#2137 closed defect (wontfix)
Trac fails on windows with mod_python
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | web frontend/mod_python | Version: | 0.9.4 |
Severity: | major | Keywords: | None |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The error reported looks like this:
[Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: Traceback (most recent call last): [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "C:\\Python23\\Lib\\site-packages\\mod_python\\apache.py", line 299, in HandlerDispatch\n result = object(req) [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "C:\\Python23\\Lib\\site-packages\\trac\\web\\modpython_frontend.py", line 199, in handler\n env = get_environment(mpr, project_opts) [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "C:\\Python23\\Lib\\site-packages\\trac\\web\\main.py", line 338, in get_environment\n return _open_environment(env_path, threaded) [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "C:\\Python23\\Lib\\site-packages\\trac\\web\\main.py", line 51, in _open_environment\n env_cache[env_path] = open_environment(env_path) [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "C:\\Python23\\lib\\site-packages\\trac\\env.py", line 354, in open_environment\n env = Environment(env_path) [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "C:\\Python23\\lib\\site-packages\\trac\\env.py", line 77, in __init__\n from trac.loader import load_components [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "C:\\Python23\\lib\\site-packages\\trac\\loader.py", line 20, in ?\n import pkg_resources [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "c:\\python23\\lib\\site-packages\\setuptools-0.6a2-py2.3.egg\\pkg_resources.py", line 2146, in ?\n working_set = WorkingSet() [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "c:\\python23\\lib\\site-packages\\setuptools-0.6a2-py2.3.egg\\pkg_resources.py", line 343, in __init__\n self.add_entry(entry) [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "c:\\python23\\lib\\site-packages\\setuptools-0.6a2-py2.3.egg\\pkg_resources.py", line 358, in add_entry\n for dist in find_distributions(entry, True): [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: File "c:\\python23\\lib\\site-packages\\setuptools-0.6a2-py2.3.egg\\pkg_resources.py", line 1372, in find_on_path\n for entry in os.listdir(path_item): [Wed Sep 28 11:15:20 2005] [error] [client 192.168.0.151] PythonHandler trac.web.modpython_frontend: WindowsError: [Errno 123] The filename, directory name, or volume label syntax is incorrect: '\\\\\\\\*.*'
Looking deeper into it i found out that sys.path[0] is the problem, because it is initialized to "/". I fixed the problem locally by removing this element from sys.path in env.py.
Attachments (1)
Change History (14)
by , 19 years ago
Attachment: | trac_trunk_r2639_setuptools_win.patch added |
---|
comment:1 by , 19 years ago
I added crude fix to the problem due to several requests to do so. It may not be a perfect one since i'm not Python guru but it works at least.
comment:2 by , 19 years ago
Component: | search system → general |
---|---|
Milestone: | 0.7.1 |
Priority: | lowest → normal |
Severity: | minor → critical |
Version: | 0.8 → devel |
(reverting back to the original settings)
comment:3 by , 19 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
This seems like a setuptools bug, not something that is a Trac problem. If it still occurs with the latest setuptools it should be reported there.
comment:4 by , 19 years ago
Milestone: | 0.9.5 |
---|---|
Resolution: | wontfix |
Severity: | blocker → normal |
Status: | closed → reopened |
Summary: | Setuptools fail on windows with mod_python → Trac fails on windows with mod_python |
Type: | task → defect |
Version: | 0.7.1 → 0.9.4 |
It seems for me it is not (just?) a problem with the setuptools. After upgrading Trac (like from 092 to 093 or from 093 to 094) to a new version the apache logs the following errors on the first request:
[Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: Traceback (most recent call last):, referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\lib\\site-packages\\mod_python\\apache.py", line 299, in HandlerDispatch\n result = object(req), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: Traceback (most recent call last):, referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\lib\\site-packages\\mod_python\\apache.py", line 299, in HandlerDispatch\n result = object(req), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\web\\modpython_frontend.py", line 199, in handler\n env = get_environment(mpr, project_opts), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\web\\main.py", line 335, in get_environment\n return _open_environment(env_path, threaded), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\web\\main.py", line 51, in _open_environment\n env_cache[env_path] = open_environment(env_path), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\env.py", line 374, in open_environment\n env = Environment(env_path), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\web\\modpython_frontend.py", line 199, in handler\n env = get_environment(mpr, project_opts), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\web\\main.py", line 335, in get_environment\n return _open_environment(env_path, threaded), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\web\\main.py", line 51, in _open_environment\n env_cache[env_path] = open_environment(env_path), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\env.py", line 374, in open_environment\n env = Environment(env_path), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\env.py", line 85, in __init__\n from trac.loader import load_components, referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: ImportError: cannot import name load_components, referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\env.py", line 85, in __init__\n from trac.loader import load_components, referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: ImportError: cannot import name load_components, referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: Traceback (most recent call last):, referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\lib\\site-packages\\mod_python\\apache.py", line 299, in HandlerDispatch\n result = object(req), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\web\\modpython_frontend.py", line 199, in handler\n env = get_environment(mpr, project_opts), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\web\\main.py", line 335, in get_environment\n return _open_environment(env_path, threaded), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\web\\main.py", line 51, in _open_environment\n env_cache[env_path] = open_environment(env_path), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\env.py", line 374, in open_environment\n env = Environment(env_path), referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: File "C:\\Python\\23\\Lib\\site-packages\\trac\\env.py", line 85, in __init__\n from trac.loader import load_components, referer: http://pscm [Mon Apr 03 12:03:39 2006] [error] [client xxx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: ImportError: cannot import name load_components, referer: http://pscm
The last ImportError repeats how many TracProject I have.
The index page falls back to the built-in one, the custom one fails to load probably due this error.
On the index page: name of the TracProject itself is correct, but the descrption is an error.
The first TracProject shows the error:
Error ([Errno 123] Die Syntax f? Dateinamen, Verzeichnisnamen oder die Datentr䧥rbezeichnung ist falsch: '\\\\*.*')
The rest shows:
Error (cannot import name load_components)
Applying the patch mentioned above to the env.py will fix and solve this issue.
So, it would be nice to incorporate this patch in an appropriate way into the source.
I run Trac on Win2k3 with mod_python.
comment:5 by , 19 years ago
Component: | ticket system → mod_python frontend |
---|
comment:6 by , 19 years ago
Sorry, it does not fall back to the built-in index page… my bad. But the rest applies.
comment:7 by , 19 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
The patch is a potential workaround, but I don't think it should be released with Trac because this problem needs to be fixed at its source. Either you have an invalid path in the PYTHONPATH
environment variable, mod_python
is modifying sys.path
in an invalid way, or this needs fixed in setuptools
. Please check your installation, and report the problem to mod_python
or setuptools
if necessary.
comment:8 by , 19 years ago
Thanks for pointing this out… I've made a little search:
As your function handle(req)
in modpython_frontend is called the request object already contains the trouble: req.hlist.directory: "∧\"
The function HandlerDispatch()
in Callback
class appends this invalid directory to the sys.path.
I had mod_python 3.1.3… upgrading to 3.2 line solves the problem. (tried 3.2.5b, 3.2.8)
comment:9 by , 18 years ago
Component: | → mod_python frontend |
---|---|
Milestone: | 0.8 |
Priority: | → normal |
Severity: | critical → major |
Type: | → defect |
Version: | 0.8.1 → 0.9.4 |
We definitely need a SpamFilter that rejects comments with too many URLs…
comment:13 by , 16 years ago
The above spam entries had a karma of 1. min_karma
should be set to 2 (it's currently set to 0), as legitimate entries with a karma of 1 are very uncommon.
comment:15 by , 15 years ago
Milestone: | 0.12.1 |
---|
Crude fix to the problem