Ticket #10295 (closed defect: fixed)

Opened 9 months ago

Last modified 1 month ago

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

Reported by: netjunki Assigned to: 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

testman4trac_unicodestringfixes2.patch (4.7 kB) - added by netjunki on 10/16/12 08:23:07.
more unicode fixes for the testman4trac wiki ui

Change History

09/13/12 21:46:31 changed 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

09/13/12 22:11:14 changed by netjunki

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

10/14/12 03:00:06 changed by seccanj

  • status changed from new to closed.
  • resolution set to fixed.

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/

10/16/12 08:23:07 changed by netjunki

  • attachment testman4trac_unicodestringfixes2.patch added.

more unicode fixes for the testman4trac wiki ui

10/16/12 08:24:20 changed by netjunki

  • status changed from closed to reopened.
  • resolution deleted.

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.

04/17/13 15:35:55 changed by matt@iua.co.za

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

04/17/13 19:26:47 changed by netjunki

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

04/21/13 23:17:08 changed by seccanj

  • status changed from reopened to closed.
  • resolution set to fixed.

Fixed in 1.6.1.


Add/Change #10295 (Trac detected an internal error: UnicodeError: source returned bytes, but no encoding specified)




Change Properties
Action