Modify

Opened 5 years ago

Closed 17 months ago

#6494 closed defect (invalid)

TracGitPlug-in: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings

Reported by: flyinflash Owned by: sjain
Priority: normal Component: GitPlugin
Severity: blocker Keywords: trac,
Cc: zoom.quiet@… Trac Release: 0.12

Description (last modified by rjollos)

I always got this message while TracGitPlugin is enable:

ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

View it online: http://proj.shuge.org/pm/browser

Python Traceback
Most recent call last:

    * File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/web/main.py", line 495, in _dispatch_request
      Code fragment:
      Line	
      490	try:
      491	if not env and env_error:
      492	raise HTTPInternalError(env_error)
      493	try:
      494	dispatcher = RequestDispatcher(env)
      495	dispatcher.dispatch(req)
      496	except RequestDone:
      497	pass
      498	resp = req._response or []
      499	 
      500	except HTTPException, e:
      Local variables:
      Name	Value
      dispatcher 	<trac.web.main.RequestDispatcher object at 0x1c30d10>
      e 	ProgrammingError('You must not use 8-bit bytestrings unless you use a ...
      env 	<trac.env.Environment object at 0x16ed2d0>
      env_error 	None
      exc_info 	(<class 'pysqlite2.dbapi2.ProgrammingError'>, ProgrammingError('You must ...
      faulty_plugins 	[]
      frames 	[]
      has_admin 	True
      message 	u'ProgrammingError: You must not use 8-bit bytestrings unless you use a ...
      plugins 	[]
      req 	<Request "GET u'/browser'">
      resp 	[]
      th 	'http://trac-hacks.org'
      traceback 	u'Traceback (most recent call last):\n File ...
      tracker 	'http://trac.edgewall.org'
    * File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/web/main.py", line 196, in dispatch
      Code fragment:
      Line	
      191	if not req.path_info or req.path_info == '/':
      192	chosen_handler = self.default_handler
      193	# pre-process any incoming request, whether a handler
      194	# was found or not
      195	chosen_handler = self._pre_process_request(req,
      196	chosen_handler)
      197	except TracError, e:
      198	raise HTTPInternalError(e)
      199	if not chosen_handler:
      200	if req.path_info.endswith('/'):
      201	# Strip trailing / and redirect
      Local variables:
      Name	Value
      chosen_handler 	<trac.versioncontrol.web_ui.browser.BrowserModule object at 0x1c30f10>
      chrome 	<trac.web.chrome.Chrome object at 0x1b3fc90>
      err 	(<class 'pysqlite2.dbapi2.ProgrammingError'>, ProgrammingError('You must ...
      handler 	<trac.versioncontrol.web_ui.browser.BrowserModule object at 0x1c30f10>
      req 	<Request "GET u'/browser'">
      self 	<trac.web.main.RequestDispatcher object at 0x1c30d10>
    * File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/web/main.py", line 339, in _pre_process_request
      Code fragment:
      Line	
      334	req.outcookie['trac_form_token']['secure'] = True
      335	return req.outcookie['trac_form_token'].value
      336	 
      337	def _pre_process_request(self, req, chosen_handler):
      338	for filter_ in self.filters:
      339	chosen_handler = filter_.pre_process_request(req, chosen_handler)
      340	return chosen_handler
      341	 
      342	def _post_process_request(self, req, *args):
      343	nbargs = len(args)
      344	resp = args
      Local variables:
      Name	Value
      chosen_handler 	<trac.versioncontrol.web_ui.browser.BrowserModule object at 0x1c30f10>
      filter_ 	<trac.versioncontrol.api.RepositoryManager object at 0x1c3c1d0>
      req 	<Request "GET u'/browser'">
      self 	<trac.web.main.RequestDispatcher object at 0x1c30d10>
    * File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/versioncontrol/api.py", line 83, in pre_process_request
      Code fragment:
      Line	
      78	 
      79	def pre_process_request(self, req, handler):
      80	from trac.web.chrome import Chrome, add_warning
      81	if handler is not Chrome(self.env):
      82	try:
      83	self.get_repository(req.authname).sync()
      84	except TracError, e:
      85	add_warning(req, _("Can't synchronize with the repository "
      86	"(%(error)s). Look in the Trac log for more "
      87	"information.", error=to_unicode(e.message)))
      88	
      Local variables:
      Name	Value
      Chrome 	<class 'trac.web.chrome.Chrome'>
      add_warning 	<function add_warning at 0x168eb18>
      handler 	<trac.versioncontrol.web_ui.browser.BrowserModule object at 0x1c30f10>
      req 	<Request "GET u'/browser'">
      self 	<trac.versioncontrol.api.RepositoryManager object at 0x1c3c1d0>
    * File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/versioncontrol/cache.py", line 215, in sync
      Code fragment:
      Line	
      210	cursor.execute("INSERT INTO node_change "
      211	" (rev,path,node_type,change_type, "
      212	" base_path,base_rev) "
      213	"VALUES (%s,%s,%s,%s,%s,%s)",
      214	(str(next_youngest),
      215	path, kind, action, bpath, brev))
      216	 
      217	# 1.3. iterate (1.1 should always succeed now)
      218	self.youngest = next_youngest
      219	next_youngest = self.repos.next_rev(next_youngest)
      220	 
      Local variables:
      Name	Value
      action 	'M'
      actionmap 	{'edit': 'E', 'add': 'A', 'move': 'M', 'copy': 'C', 'delete': 'D'}
      authz 	<trac.versioncontrol.api.Authorizer object at 0x1f96310>
      bpath 	'online/seed/urls.py'
      brev 	u'c81205e9841ea91f5e1f9f6a22d18279ff8d9120'
      cset 	<tracext.git.git_fs.GitChangeset object at 0x203e850>
      cursor 	<trac.db.util.IterableCursor object at 0x1e60f90>
      db 	<trac.db.pool.PooledConnection object at 0x18c3e10>
      feedback 	None
      key 	'youngest_rev'
      kind 	'F'
      kindmap 	{'file': 'F', 'dir': 'D'}
      metadata 	{u'youngest_rev': u'c81205e9841ea91f5e1f9f6a22d18279ff8d9120', ...
      name 	u'youngest_rev'
      next_youngest 	'c85a1a01b4f22c11bfd548e92e2dcf895467880d'
      path 	'online/repo/\xe5\xb7\xa5\xe4\xb8\x9a\xe6\x8a\x80\xe6\x9c\xaf/reStructuredT ...
      repos_youngest 	'ac25c1c5f18e91d86e93c5aa52fb95f80ecd18e6'
      repository_dir 	u'git:/home/lee/proj.shuge.org/shuge.git'
      self 	<tracext.git.git_fs.CachedRepository2 object at 0x1f96190>
      value 	u'c81205e9841ea91f5e1f9f6a22d18279ff8d9120'
    * File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/db/util.py", line 64, in execute
      Code fragment:
      Line	
      59	return r
      60	except Exception, e:
      61	self.log.debug('execute exception: %r', e)
      62	raise
      63	if args:
      64	return self.cursor.execute(sql_escape_percent(sql), args)
      65	return self.cursor.execute(sql)
      66	 
      67	def executemany(self, sql, args=None):
      68	if self.log:
      69	self.log.debug('SQL: %r', sql)
      Local variables:
      Name	Value
      args 	('c85a1a01b4f22c11bfd548e92e2dcf895467880d', ...
      self 	<trac.db.util.IterableCursor object at 0x1e60f90>
      sql 	'INSERT INTO node_change (rev,path,node_type,change_type, ...
    * File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/db/sqlite_backend.py", line 76, in execute
      Code fragment:
      Line	
      71	PyFormatCursor.__init__(self, con)
      72	self.rows = []
      73	self.pos = 0
      74	 
      75	def execute(self, *args):
      76	result = PyFormatCursor.execute(self, *args)
      77	self.rows = PyFormatCursor.fetchall(self)
      78	self.pos = 0
      79	return result
      80	 
      81	def fetchone(self):
      Local variables:
      Name	Value
      args 	('INSERT INTO node_change (rev,path,node_type,change_type, ...
      self 	<trac.db.sqlite_backend.EagerCursor object at 0x1bcbe90>
    * File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/db/sqlite_backend.py", line 55, in execute
      Code fragment:
      Line	
      50	raise
      51	def execute(self, sql, args=None):
      52	if args:
      53	sql = sql % (('?',) * len(args))
      54	return self._rollback_on_error(sqlite.Cursor.execute, sql,
      55	args or [])
      56	def executemany(self, sql, args=None):
      57	if args:
      58	sql = sql % (('?',) * len(args[0]))
      59	return self._rollback_on_error(sqlite.Cursor.executemany, sql,
      60	args or [])
      Local variables:
      Name	Value
      args 	('c85a1a01b4f22c11bfd548e92e2dcf895467880d', ...
      self 	<trac.db.sqlite_backend.EagerCursor object at 0x1bcbe90>
      sql 	'INSERT INTO node_change (rev,path,node_type,change_type, ...
    * File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/db/sqlite_backend.py", line 47, in _rollback_on_error
      Code fragment:
      Line	
      42	sqlite_version_string = '%d.%d.%d' % (_ver[0], _ver[1], int(_ver[2]))
      43	 
      44	class PyFormatCursor(sqlite.Cursor):
      45	def _rollback_on_error(self, function, *args, **kwargs):
      46	try:
      47	return function(self, *args, **kwargs)
      48	except sqlite.DatabaseError:
      49	self.cnx.rollback()
      50	raise
      51	def execute(self, sql, args=None):
      52	if args:
      Local variables:
      Name	Value
      args 	('INSERT INTO node_change (rev,path,node_type,change_type, ...
      function 	<method 'execute' of 'pysqlite2.dbapi2.Cursor' objects>
      kwargs 	{}
      self 	<trac.db.sqlite_backend.EagerCursor object at 0x1bcbe90>

File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/web/main.py", line 495, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/web/main.py", line 196, in dispatch
  chosen_handler)
File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/web/main.py", line 339, in _pre_process_request
  chosen_handler = filter_.pre_process_request(req, chosen_handler)
File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/versioncontrol/api.py", line 83, in pre_process_request
  self.get_repository(req.authname).sync()
File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/versioncontrol/cache.py", line 215, in sync
  path, kind, action, bpath, brev))
File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/db/util.py", line 64, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/db/sqlite_backend.py", line 76, in execute
  result = PyFormatCursor.execute(self, *args)
File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/db/sqlite_backend.py", line 55, in execute
  args or [])
File "/usr/lib64/python2.6/site-packages/Trac-0.12dev_r9078-py2.6.egg/trac/db/sqlite_backend.py", line 47, in _rollback_on_error
  return function(self, *args, **kwargs)
Trac  	0.12dev-r9078
Python 	2.6.4 (r264:75706, Jan 19 2010, 02:05:06) [GCC 4.3.4]
setuptools 	0.6
pytz 	2009r
SQLite 	3.6.20
pysqlite 	2.5.6
Genshi 	0.6dev-r1092
Babel 	1.0dev-r482
Pygments 	1.1.1
GIT 	1.6.4.4
jQuery	1.3.2

Attachments (0)

Change History (1)

comment:1 Changed 17 months ago by rjollos

  • Component changed from TracGitPlugin to GitPlugin
  • Description modified (diff)
  • Resolution set to invalid
  • Status changed from new to closed

This should have been filed against the GitPlugin, but since the ticket is very old, I'm just going to close it.

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.