ImportError: cannot import name compat

2,265 views
Skip to first unread message

RM

unread,
Jun 10, 2008, 3:38:25 AM6/10/08
to Trac Users
I just installed 0.11rc2 and am getting an ImportError when trying to
save wiki pages. Here's the full stack:

[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] mod_python
(pid=23954, interpreter='main_interpreter', phase='PythonHandl
er', handler='trac.web.modpython_frontend'): Application error,
referer: http://morison.org/blood.ca/trac/kpd/wiki/TracDefaultStartP
age?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] ServerName:
'bolet.morison.org', referer: http://morison.org/blood.ca/tra
c/kpd/wiki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167]
DocumentRoot: '/var/www/', referer: http://morison.org/blood.ca/trac/kpd/
wiki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] URI: '/
blood.ca/trac/kpd/wiki/TracDefaultStartPage', referer: http://mori
son.org/blood.ca/trac/kpd/wiki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] Location: '/
blood.ca/trac', referer: http://morison.org/blood.ca/trac/kpd
/wiki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] Directory:
None, referer: http://morison.org/blood.ca/trac/kpd/wiki/TracD
efaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] Filename: '/
var/www/blood.ca', referer: http://morison.org/blood.ca/trac/
kpd/wiki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] PathInfo: '/
trac/kpd/wiki/TracDefaultStartPage', referer: http://morison.
org/blood.ca/trac/kpd/wiki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] Traceback
(most recent call last):, referer: http://morison.org/blood.ca/
trac/kpd/wiki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] File "/
usr/lib/python2.5/site-packages/mod_python/importer.py", line 15
37, in HandlerDispatch\n default=default_handler, arg=req,
silent=hlist.silent), referer: http://morison.org/blood.ca/trac/kpd/wi
ki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] File "/
usr/lib/python2.5/site-packages/mod_python/importer.py", line 12
29, in _process_target\n result = _execute_target(config, req,
object, arg), referer: http://morison.org/blood.ca/trac/kpd/wiki/T
racDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] File "/
usr/lib/python2.5/site-packages/mod_python/importer.py", line 11
28, in _execute_target\n result = object(arg), referer:
http://morison.org/blood.ca/trac/kpd/wiki/TracDefaultStartPage?action=edi
t
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] File "/
usr/lib/python2.5/site-packages/Trac-0.11rc2-py2.5.egg/trac/web/
modpython_frontend.py", line 127, in handler\n from trac.web.main
import dispatch_request, referer: http://morison.org/blood.ca/t
rac/kpd/wiki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] File "/
usr/lib/python2.5/site-packages/Trac-0.11rc2-py2.5.egg/trac/web/
main.py", line 47, in <module>\n from trac.web.chrome import
Chrome, referer: http://morison.org/blood.ca/trac/kpd/wiki/TracDefau
ltStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167] File "/
usr/lib/python2.5/site-packages/Trac-0.11rc2-py2.5.egg/trac/web/
chrome.py", line 40, in <module>\n from trac.util import compat,
get_reporter_id, presentation, get_pkginfo, \\, referer: http://
morison.org/blood.ca/trac/kpd/wiki/TracDefaultStartPage?action=edit
[Tue Jun 10 00:28:11 2008] [error] [client 192.168.66.167]
ImportError: cannot import name compat, referer: http://morison.org/blood
.ca/trac/kpd/wiki/TracDefaultStartPage?action=edit

Leo Petr

unread,
Jun 24, 2008, 1:28:19 PM6/24/08
to Trac Users
On Jun 10, 3:38 am, RM <rod...@gmail.com> wrote:
> I just installed 0.11rc2 and am getting an ImportError when trying to
> save wiki pages. Here's the full stack:

I am getting the same error with Trac 0.11 final. I'm using the
official .tar.gz release on Ubuntu.

http://pastebin.ca/1055176

Regards,

Leons Petrazickis
http://planetdb2.com/

Leons Petrazickis

unread,
Jun 24, 2008, 3:12:32 PM6/24/08
to Trac Users
On Tue, Jun 24, 2008 at 1:28 PM, Leo Petr <leons.pe...@gmail.com> wrote:
>
> On Jun 10, 3:38 am, RM <rod...@gmail.com> wrote:
>> I just installed 0.11rc2 and am getting an ImportError when trying to
>> save wiki pages. Here's the full stack:
>
> I am getting the same error with Trac 0.11 final. I'm using the
> official .tar.gz release on Ubuntu.
>
> http://pastebin.ca/1055176

Well, I've resolved it by copying compat.py to compat2.py and
switching all the references to it in chrome.py. Bizarre.
Synchronization issue? Namespace issue? Not sure.

Jashugan

unread,
Jun 24, 2008, 2:44:01 PM6/24/08
to Trac Users
On Jun 24, 10:28 am, Leo Petr <leons.petrazic...@gmail.com> wrote:
> On Jun 10, 3:38 am, RM <rod...@gmail.com> wrote:
>
> > I just installed 0.11rc2 and am getting an ImportError when trying to
> > save wiki pages. Here's the full stack:
>
> I am getting the same error with Trac 0.11 final. I'm using the
> official .tar.gz release on Ubuntu.
>
> http://pastebin.ca/1055176
>

I too am getting this error with the release version of Trac 0.11 (see
below). However, it only happens sometimes. When I reload the page the
error disappears. I had been running Trac 0.11rc1 up until the upgrade
without any problems.

I tried going to python and importing compat, but that failed. I also
tried doing a search for compat using find, but still came up with
nothing. I'm using Leopard Server with Trac installed from
easy_install and everything else installed using macports.

[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] Filename: '/
opt/local/var/www/php/trac', referer: http://server.company.com/trac/timeline
[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] PathInfo: '/
chrome/common/changeset.png', referer: http://server.company.com/trac/timeline
[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] Traceback
(most recent call last):, referer: http://server.company.com/trac/timeline
[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] File "/opt/
local/lib/python2.5/site-packages/mod_python/importer.py", line 1537,
in HandlerDispatch\n default=default_handler, arg=req,
silent=hlist.silent), referer: http://server.company.com/trac/timeline
[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] File "/opt/
local/lib/python2.5/site-packages/mod_python/importer.py", line 1229,
in _process_target\n result = _execute_target(config, req, object,
arg), referer: http://server.company.com/trac/timeline
[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] File "/opt/
local/lib/python2.5/site-packages/mod_python/importer.py", line 1128,
in _execute_target\n result = object(arg), referer:
http://server.company.com/trac/timeline
[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] File "/opt/
local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/web/
modpython_frontend.py", line 127, in handler\n from trac.web.main
import dispatch_request, referer: http://server.company.com/trac/timeline
[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] File "/opt/
local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/web/
main.py", line 47, in <module>\n from trac.web.chrome import
Chrome, referer: http://server.company.com/trac/timeline
[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] File "/opt/
local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/web/
chrome.py", line 40, in <module>\n from trac.util import compat,
get_reporter_id, presentation, get_pkginfo, \\, referer:
http://server.company.com/trac/timeline
[Tue Jun 24 11:08:06 2008] [error] [client 10.104.3.13] ImportError:
cannot import name compat, referer: http://server.company.com/trac/timeline

Jashugan

unread,
Jun 24, 2008, 2:56:58 PM6/24/08
to Trac Users
This seems to have solved the issues for me (I think)...

sudo trac-admin /opt/local/var/trac/project/ deploy /opt/local/share/
trac/

I had manually copied the htdoc directory initially but forgot to copy
over the cgi-bin directory.

Jashugan

unread,
Jun 24, 2008, 7:09:39 PM6/24/08
to Trac Users
On Jun 24, 11:56 am, Jashugan <jashu...@gmail.com> wrote:
> This seems to have solved the issues for me (I think)...
>
> sudo trac-admin /opt/local/var/trac/project/ deploy /opt/local/share/
> trac/
>

Never mind, I'm still getting errors.

Jashugan

unread,
Jun 24, 2008, 7:38:08 PM6/24/08
to Trac Users
I tried this, but it didn't help.

$ find . -name compat*
./trac/tests/functional/compat.py
./trac/tests/functional/compat.pyc
./trac/util/compat.py
./trac/util/compat.pyc

$ cd trac/tests/functional
$ sudo mv compat.py testcompat.py
$ sudo rm compat.pyc

On Jun 24, 12:12 pm, "Leons Petrazickis" <leons.petrazic...@gmail.com>
wrote:

> Well, I've resolved it by copying compat.py to compat2.py and
> switching all the references to it in chrome.py. Bizarre.
> Synchronization issue? Namespace issue? Not sure.
>

I just tried this, but it seems to be working for now.

kurgbe

unread,
Jul 2, 2008, 9:13:35 AM7/2/08
to Trac Users
> Well, I've resolved it by copying compat.py to compat2.py and
> switching all the references to it in chrome.py. Bizarre.
> Synchronization issue? Namespace issue? Not sure.

I had the same problem (Ubuntu trac 0,11)

The above trick worked for me as well. thanks

(To switch all references in chrome.py, do a global replace of
"compat." by "compat2.")

David Starr

unread,
Jul 22, 2008, 9:32:19 AM7/22/08
to trac-...@googlegroups.com
I had this same issue on OSX Leopard desktop (not server) when upgrading a 10.4 Trac to 0.11 Final and running apache 2.2.8 & mod_wsgi 2.0.

The solution below worked for me.


On 24-Jun-08, at 8:38 PM, Jashugan wrote:

$ find . -name compat*
./trac/tests/functional/compat.py
./trac/tests/functional/compat.pyc
./trac/util/compat.py
./trac/util/compat.pyc

$ cd trac/tests/functional
$ sudo mv compat.py testcompat.py
$ sudo rm compat.pyc


David Starr
Technical Director
Trapeze Animation

marshall

unread,
Jul 22, 2008, 4:27:57 PM7/22/08
to Trac Users
I had this exact problem on FreeBSD 6.3 after upgrading various
packages from ports. The solution below worked on my system, as
well. Doesn't make much sense, but I thank you all for this thread
and finding a workaround until newer builds fix the issue.
Reply all
Reply to author
Forward
0 new messages