Mercurial plugin error: TypeError: __init__() got an unexpected keyword argument 'interactive'

374 views
Skip to first unread message

andre...@gmail.com

unread,
Jul 5, 2009, 11:46:55 AM7/5/09
to Trac Users
I've got this message error when I tried to create or access any Trac
project based on a Mercurial repository:

TypeError: __init__() got an unexpected keyword argument 'interactive'

Python Traceback
Most recent call last:

* File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-
py2.6.egg/trac/web/main.py", line 444, in _dispatch_request
Code fragment:
439. try:
440. if not env and env_error:
441. raise HTTPInternalError(env_error)
442. try:
443. dispatcher = RequestDispatcher(env)
444. dispatcher.dispatch(req)
445. except RequestDone:
446. pass
447. resp = req._response or []
448.
449. except HTTPException, e:
Local variables:
Name Value
after [u' except RequestDone:', u' pass', u' resp = ...
before [u' try:', u' if not env and env_error:', u' raise ...
dispatcher <trac.web.main.RequestDispatcher object at
0x7f95979ceed0>
e TypeError("__init__() got an unexpected keyword argument
'interactive'",)
env <trac.env.Environment object at 0x7f95972c9110>
env_error None
exc_info (<type 'exceptions.TypeError'>, TypeError("__init__()
got an unexpected ...
filename '/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-
py2.6.egg/trac/web/m ...
frames [{'function': '_dispatch_request', 'lines_before': [u'
try:', u' ...
has_admin True
line u' dispatcher.dispatch(req)'
lineno 443
message u"TypeError: __init__() got an unexpected keyword
argument 'interactive'"
req <Request "GET u'/'">
resp []
tb <traceback object at 0x7f9597be52d8>
tb_hide None
traceback u'Traceback (most recent call last):\n File ...
* File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-
py2.6.egg/trac/web/main.py", line 175, in dispatch
Code fragment:
170. if not req.path_info or req.path_info == '/':
171. chosen_handler = self.default_handler
172. # pre-process any incoming request, whether a handler
173. # was found or not
174. chosen_handler = self._pre_process_request(req,
175. chosen_handler)
176. except TracError, e:
177. raise HTTPInternalError(e)
178. if not chosen_handler:
179. if req.path_info.endswith('/'):
180. # Strip trailing / and redirect
Local variables:
Name Value
chosen_handler <trac.wiki.web_ui.WikiModule object at
0x7f95979f1410>
chrome <trac.web.chrome.Chrome object at 0x7f959782dd50>
err (<type 'exceptions.TypeError'>, TypeError("__init__() got
an unexpected ...
handler <trac.prefs.web_ui.PreferencesModule object at
0x7f95979f14d0>
req <Request "GET u'/'">
self <trac.web.main.RequestDispatcher object at 0x7f95979ceed0>
* File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-
py2.6.egg/trac/web/main.py", line 295, in _pre_process_request
Code fragment:
290. req.outcookie['trac_form_token']['secure'] = True
291. return req.outcookie['trac_form_token'].value
292.
293. def _pre_process_request(self, req, chosen_handler):
294. for filter_ in self.filters:
295. chosen_handler = filter_.pre_process_request(req,
chosen_handler)
296. return chosen_handler
297.
298. def _post_process_request(self, req, *args):
299. nbargs = len(args)
300. resp = args
Local variables:
Name Value
chosen_handler <trac.wiki.web_ui.WikiModule object at
0x7f95979f1410>
filter_ <trac.versioncontrol.api.RepositoryManager object at
0x7f95979f1810>
req <Request "GET u'/'">
self <trac.web.main.RequestDispatcher object at 0x7f95979ceed0>
* File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-
py2.6.egg/trac/versioncontrol/api.py", line 86, in pre_process_request
Code fragment:
81.
82. def pre_process_request(self, req, handler):
83. from trac.web.chrome import Chrome, add_warning
84. if handler is not Chrome(self.env):
85. try:
86. self.get_repository(req.authname).sync()
87. except TracError, e:
88. add_warning(req, _("Can't synchronize with the repository
"
89. "(%(error)s). Look in the Trac log for more "
90. "information.", error=to_unicode(e.message)))
91.
Local variables:
Name Value
Chrome <class 'trac.web.chrome.Chrome'>
add_warning <function add_warning at 0x7f9597294d70>
handler <trac.wiki.web_ui.WikiModule object at 0x7f95979f1410>
req <Request "GET u'/'">
self <trac.versioncontrol.api.RepositoryManager object at
0x7f95979f1810>
* File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-
py2.6.egg/trac/versioncontrol/api.py", line 157, in get_repository
Code fragment:
152. repos = self._cache[tid]
153. else:
154. rtype, rdir = self.repository_type, self.repository_dir
155. if not os.path.isabs(rdir):
156. rdir = os.path.join(self.env.path, rdir)
157. repos = self._connector.get_repository(rtype, rdir,
authname)
158. self._cache[tid] = repos
159. return repos
160. finally:
161. self._lock.release()
162.
Local variables:
Name Value
authname u'andref'
db <trac.db.pool.PooledConnection object at 0x7f9597d47e60>
rdir u'/srv/hg/republicaos'
rtype u'hg'
self <trac.versioncontrol.api.RepositoryManager object at
0x7f95979f1810>
tid 140280238983504
* File "build/bdist.linux-x86_64/egg/tracext/hg/backend.py", line
218, in get_repository
Local variables:
Name Value
authname u'andref'
dir u'/srv/hg/republicaos'
self <tracext.hg.backend.MercurialConnector object at
0x7f9597be95d0>
type u'hg'
* File "build/bdist.linux-x86_64/egg/tracext/hg/backend.py", line
165, in _setup_ui
Local variables:
Name Value
hgrc_path u''
self <tracext.hg.backend.MercurialConnector object at
0x7f9597be95d0>
* File "build/bdist.linux-x86_64/egg/tracext/hg/backend.py", line
262, in __init__
Local variables:
Name Value
args ()
kwargs {'interactive': False}
log <logging.Logger instance at 0x7f9596df6c68>
self <tracext.hg.backend.trac_ui object at 0x7f95979f17d0>

File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-py2.6.egg/
trac/web/main.py", line 444, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-py2.6.egg/
trac/web/main.py", line 175, in dispatch
chosen_handler)
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-py2.6.egg/
trac/web/main.py", line 295, in _pre_process_request
chosen_handler = filter_.pre_process_request(req, chosen_handler)
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-py2.6.egg/
trac/versioncontrol/api.py", line 86, in pre_process_request
self.get_repository(req.authname).sync()
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5rc1-py2.6.egg/
trac/versioncontrol/api.py", line 157, in get_repository
repos = self._connector.get_repository(rtype, rdir, authname)
File "build/bdist.linux-x86_64/egg/tracext/hg/backend.py", line 218,
in get_repositoryFile "build/bdist.linux-x86_64/egg/tracext/hg/
backend.py", line 165, in _setup_uiFile "build/bdist.linux-x86_64/egg/
tracext/hg/backend.py", line 262, in __init__

System Information:

User Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1pre)
Gecko/20090704 Ubuntu/9.04 (jaunty) Shiretoko/3.5.1pre
Trac: 0.11.5rc1
Python: 2.6.2 (release26-maint, Apr 19 2009, 02:15:38) [GCC 4.3.3]
setuptools: 0.6c9
SQLite: 3.6.10
pysqlite: 2.4.1
Genshi: 0.5.1
Pygments: 1.0
Mercurial: 1.3
jQuery: 1.2.6

Any ideas?

Regards,

André

Hal

unread,
Jul 13, 2009, 11:37:15 AM7/13/09
to Trac Users
On Jul 5, 8:46 am, "andref.d...@gmail.com" <andref.d...@gmail.com>
wrote:
> I've got this message error when I tried to create or access any Trac
> project based on aMercurialrepository:
>
> TypeError: __init__() got an unexpected keyword argument 'interactive'
...
> System Information:
>
> User Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1pre)
> Gecko/20090704 Ubuntu/9.04 (jaunty) Shiretoko/3.5.1pre
> Trac:   0.11.5rc1
> Python:         2.6.2 (release26-maint, Apr 19 2009, 02:15:38) [GCC 4.3.3]
> setuptools:     0.6c9
> SQLite:         3.6.10
> pysqlite:       2.4.1
> Genshi:         0.5.1
> Pygments:       1.0
> Mercurial:      1.3
> jQuery: 1.2.6
>
> Any ideas?

As a workaround, downgrade to mercurial 1.2.x. I ran into the same
issue, and that "resolved" it:
easy_install 'mercurial<1.3'

Olemis Lang

unread,
Jul 13, 2009, 2:07:55 PM7/13/09
to trac-...@googlegroups.com
On Mon, Jul 13, 2009 at 10:37 AM, Hal<hal....@gmail.com> wrote:
>
> On Jul 5, 8:46 am, "andref.d...@gmail.com" <andref.d...@gmail.com>
> wrote:
>> I've got this message error when I tried to create or access any Trac
>> project based on aMercurialrepository:
>>
>> TypeError: __init__() got an unexpected keyword argument 'interactive'
>>
[...]

>> Any ideas?
>
> As a workaround, downgrade to mercurial 1.2.x. I ran into the same
> issue, and that "resolved" it:
>  easy_install 'mercurial<1.3'
>

Oh ! Yes !

I did it . I forgot to mention that I installed Hg connector using 1.3
and I experienced the same (and a few more ;o) problems. It needs some
minor changes since it seems that some refactorings have been
performed in Mercurial and things are not where they used to be.
Thanks God Hg is implemented in Py !

Please apply the following patch to backend.py (i.e. TracMercurial
r7744 for Trac 0.11)

{{{
--- /media/A-Denys14GB/soft/Tools/PM/trac/tracX/hg/backend.py
2008-12-03 17:43:40.000000000 -0500
+++ /media/A-Denys14GB/soft/Tools/PM/trac/tracX/hg/backend_fixed.py
2009-07-08 06:39:09.000000000 -0500
@@ -47,7 +47,7 @@
from mercurial import hg
from mercurial.hg import repository
from mercurial.ui import ui
- from mercurial.repo import RepoError
+ from mercurial.error import RepoError
from mercurial.revlog import LookupError
from mercurial.node import hex, short, nullid
from mercurial.util import pathto, cachefunc
@@ -204,8 +204,8 @@
def get_repository(self, type, dir, authname):
"""Return a `MercurialRepository`"""
if not self._version:
- from mercurial.version import get_version
- self._version = get_version()
+ from mercurial.__version__ import version
+ self._version = version
self.env.systeminfo.append(('Mercurial', self._version))
if not self.ui:
self._setup_ui(self.config.get(type, 'hgrc'))
@@ -251,7 +251,7 @@
class trac_ui(ui):
def __init__(self, log, *args, **kwargs):
kwargs = kwargs.copy()
- kwargs['interactive'] = False
+ # kwargs['interactive'] = False
ui.__init__(self, *args, **kwargs)
self.log = log
}}}

PS: If anybody has the time, please, submit a patch to Trac's site .
Other people might need it too ;o)

--
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:

Georg

unread,
Jul 13, 2009, 2:13:40 PM7/13/09
to trac-...@googlegroups.com
There's a patch pending integration into Trac SVN.  It works for me.  See http://trac.edgewall.org/ticket/8460

--
Regards,
Georg.


Olemis Lang

unread,
Jul 13, 2009, 2:22:00 PM7/13/09
to trac-...@googlegroups.com
On Mon, Jul 13, 2009 at 1:13 PM, Georg<gwk...@googlemail.com> wrote:
> There's a patch pending integration into Trac SVN.  It works for me.  See
> http://trac.edgewall.org/ticket/8460
>

Well as you can see in my previous that patch doesnt work for me since
there are a few more things that need to be changed in `backend.py`.

Thnx anyway for the pointer ;o).

Olemis Lang

unread,
Jul 13, 2009, 2:41:19 PM7/13/09
to trac-...@googlegroups.com
On Mon, Jul 13, 2009 at 1:22 PM, Olemis Lang<ole...@gmail.com> wrote:
> On Mon, Jul 13, 2009 at 1:13 PM, Georg<gwk...@googlemail.com> wrote:
>> There's a patch pending integration into Trac SVN.  It works for me.  See
>> http://trac.edgewall.org/ticket/8460
>>
>
> Well as you can see in my previous that patch doesnt work for me since
> there are a few more things that need to be changed in `backend.py`.
>

Well the patch you mention is for rev 8352 and the stable dist is at 7744:

I saw the code in there and a better patch (for 7744 ;o) would be :

{{{
--- /media/A-Denys14GB/soft/Tools/PM/trac/tracX/hg/backend.py 2008-12-03
17:43:40.000000000 -0500

+++ /media/A-Denys14GB/soft/Tools/PM/trac/tracX/hg/backend_fixed.py 2009-07-13
14:42:25.000000000 -0500
@@ -47,8 +47,12 @@


from mercurial import hg
from mercurial.hg import repository
from mercurial.ui import ui

+
from mercurial.repo import RepoError
from mercurial.revlog import LookupError
+ if repr(RepoError) == "<unloaded module 'RepoError'>":
+ from mercurial.error import RepoError, LookupError
+


from mercurial.node import hex, short, nullid
from mercurial.util import pathto, cachefunc

from mercurial.cmdutil import walkchangerevs
@@ -204,7 +208,10 @@


def get_repository(self, type, dir, authname):
"""Return a `MercurialRepository`"""
if not self._version:
- from mercurial.version import get_version

+ try:
+ from mercurial.version import get_version
+ except ImportError: # gone in Mercurial 1.2 (hg:9626819b2e3d)
+ from mercurial.util import version as get_version
self._version = get_version()


self.env.systeminfo.append(('Mercurial', self._version))
if not self.ui:

@@ -251,7 +258,7 @@


class trac_ui(ui):
def __init__(self, log, *args, **kwargs):
kwargs = kwargs.copy()
- kwargs['interactive'] = False
+ # kwargs['interactive'] = False
ui.__init__(self, *args, **kwargs)
self.log = log
}}}

It should work with multiple versions of Mercurial ;o)

Reply all
Reply to author
Forward
0 new messages