Modify

Opened 2 years ago

Closed 17 months ago

#10295 closed defect (fixed)

Trac detected an internal error: UnicodeError: source returned bytes, but no encoding specified

Reported by: netjunki Owned by: seccanj
Priority: normal Component: TestManagerForTracPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

After install test manager in Trac 1.0beta1 I get the following error when trying to load the Test Manager page:

 Trac detected an internal error:

UnicodeError: source returned bytes, but no encoding specified

I'm guessing this is related to this note about changes in the 1.0 API to genshi. But I'm not sure how to go about fixing it myself.

Here's the stack trace:

File "build/bdist.macosx-10.7-intel/egg/trac/web/main.py", line 490, in _dispatch_request
  dispatcher.dispatch(req)
File "build/bdist.macosx-10.7-intel/egg/trac/web/main.py", line 224, in dispatch
  content_type)
File "build/bdist.macosx-10.7-intel/egg/trac/web/chrome.py", line 968, in render_template
  stream |= self._filter_stream(req, method, filename, stream, data)
File "/Users/ben/tmp/trac/trac/genshi-trunk/genshi/core.py", line 133, in __or__
  return Stream(_ensure(function(self)), serializer=self.serializer)
File "build/bdist.macosx-10.7-intel/egg/trac/web/chrome.py", line 1147, in inner
  data)
File "build/bdist.macosx-10.7-intel/egg/testmanager/wiki.py", line 153, in filter_stream
  return self._catalog_wiki_view(req, formatter, page_name, stream)
File "build/bdist.macosx-10.7-intel/egg/testmanager/wiki.py", line 238, in _catalog_wiki_view
  HTML(self._build_catalog_tree(formatter.context, page_name, mode, fulldetails, table_columns, table_columns_map, custom_ctx)),
File "/Users/ben/tmp/trac/trac/genshi-trunk/genshi/input.py", line 436, in HTML
  return Stream(list(HTMLParser(BytesIO(text), encoding=encoding)))
File "/Users/ben/tmp/trac/trac/genshi-trunk/genshi/core.py", line 273, in _ensure
  event = stream.next()
File "/Users/ben/tmp/trac/trac/genshi-trunk/genshi/input.py", line 443, in _coalesce
  for kind, data, pos in chain(stream, [(None, None, None)]):
File "/Users/ben/tmp/trac/trac/genshi-trunk/genshi/input.py", line 335, in _generate
  raise UnicodeError("source returned bytes, but no encoding specified")

Attachments (1)

testman4trac_unicodestringfixes2.patch (4.7 KB) - added by netjunki 2 years ago.
more unicode fixes for the testman4trac wiki ui

Download all attachments as: .zip

Change History (8)

comment:1 Changed 2 years ago by netjunki

I prepared a patch for this that fixed the errors I was seeing after trying to install. I need to play around with Test Manager some more to confirm all the fixes. I tried to attach the patch but it got rejected as spam...

http://netjunki.org/testman4trac_unicode.patch

comment:2 Changed 2 years ago by netjunki

This was updated again just a moment ago... I had missed a couple that I found while poking around the UI...

comment:3 Changed 2 years ago by seccanj

  • Resolution set to fixed
  • Status changed from new to closed

Fixed the compatibility with Trac 1.0 in release 1.5.1!!! :D

Thanks netjunky for your patch on this one.

Check it out here:
https://sourceforge.net/projects/testman4trac/files/

Changed 2 years ago by netjunki

more unicode fixes for the testman4trac wiki ui

comment:4 Changed 2 years ago by netjunki

  • Resolution fixed deleted
  • Status changed from closed to reopened

No problem. Sorry I've been quiet... been dealing with some family stuff. I got a chance to fire this up finally. 1.5.2 loaded correctly and installed but there were still some unicode errors lurking (not surprising since I wasn't able to load a lot of the pages due to DB issues... thanks for fixing those btw!). I've attached a second patch against your current svn trunk (r43) with additional fixes.

There were two classes of fixes:

  1. HTML() and HTML('  ') needed to use u strings.
  2. I guess I missed one of the forms last time around.

comment:5 Changed 17 months ago by matt@…

Is there any resolution to this? I just installed the latest version (1.5.2) of this plugin with the latest version of Trac, and as soon as I try and open a test plan I get the unicode error again.

I'm on a Windows 7 machine - full Python traceback below.

Most recent call last:
File "c:/users/matts/appdata/local/temp/easy_install-sr9dhe/Trac-1.0-py2.7-win32.egg.tmp/trac/web/main.py", line 497, in _dispatch_request
File "c:/users/matts/appdata/local/temp/easy_install-sr9dhe/Trac-1.0-py2.7-win32.egg.tmp/trac/web/main.py", line 233, in dispatch
File "c:/users/matts/appdata/local/temp/easy_install-sr9dhe/Trac-1.0-py2.7-win32.egg.tmp/trac/web/chrome.py", line 968, in render_template
File "c:/users/matts/appdata/local/temp/easy_install-txhquy/Genshi-0.7-py2.7-win32.egg.tmp/genshi/core.py", line 133, in __or__
File "c:/users/matts/appdata/local/temp/easy_install-sr9dhe/Trac-1.0-py2.7-win32.egg.tmp/trac/web/chrome.py", line 1147, in inner
File "build/bdist.linux-x86_64/egg/testmanager/wiki.py", line 147, in filter_stream
File "build/bdist.linux-x86_64/egg/testmanager/wiki.py", line 455, in _testcase_wiki_view
File "c:/users/matts/appdata/local/temp/easy_install-txhquy/Genshi-0.7-py2.7-win32.egg.tmp/genshi/input.py", line 442, in HTML
File "c:/users/matts/appdata/local/temp/easy_install-txhquy/Genshi-0.7-py2.7-win32.egg.tmp/genshi/core.py", line 273, in _ensure
File "c:/users/matts/appdata/local/temp/easy_install-txhquy/Genshi-0.7-py2.7-win32.egg.tmp/genshi/input.py", line 449, in _coalesce
File "c:/users/matts/appdata/local/temp/easy_install-txhquy/Genshi-0.7-py2.7-win32.egg.tmp/genshi/input.py", line 337, in _generate

comment:6 Changed 17 months ago by netjunki

I think the patch attached to this ticket needs to be applied to the current sources in the testman4trac svn repository.

comment:7 Changed 17 months ago by seccanj

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in 1.6.1.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.