Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#3128 closed defect (fixed)

UnicodeDecodeError in /account

Reported by: Markus Tacker <m@…> Owned by: cboos
Priority: normal Milestone: 0.10
Component: general Version: devel
Severity: minor Keywords: UnicodeDecodeError
Cc:
Release Notes:
API Changes:

Description

Appears in r3281.

Happens when I try to change my password aftre click on "Change Password" Button.

PythonHandler trac.web.modpython_frontend: Traceback (most recent call last):
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch\n    result = object(req)
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/trac/web/modpython_frontend.py", line 87, in handler\n    gateway.run(dispatch_request)
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/trac/web/wsgi.py", line 87, in run\n    response = application(self.environ, self._start_response)
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 329, in dispatch_request\n    req.hdf['title'] = to_unicode(e) or 'Error'
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/trac/util/__init__.py", line 108, in to_unicode\n    return ' '.join([unicode(arg) for arg in text.args])
PythonHandler trac.web.modpython_frontend: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)

Attachments (0)

Change History (5)

comment:1 Changed 9 years ago by cboos

Could you please do the following change, repeat the operation, and then tell me what is written in the error page? I've not been able to figure out what was the exception raised from the hacks:AccountManagerPlugin which was triggering this.

  • trac/util/__init__.py

     
    9898                return unicode(text)
    9999            except UnicodeError:
    100100                # unicode arguments given to the exception (e.g. parse_date)
    101                 return ' '.join([unicode(arg) for arg in text.args])
     101                return ' '.join([to_unicode(arg) for arg in text.args])
    102102        return unicode(text)
    103103    errors = lossy and 'replace' or 'strict'
    104104    try:

comment:2 Changed 9 years ago by Markus Tacker <m@…>

Yes. {{{Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 299, in dispatch_request

dispatcher.dispatch(req)

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 189, in dispatch

resp = chosen_handler.process_request(req)

File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 51, in process_request File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 67, in _do_change_password File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 88, in set_password File "build/bdist.linux-i686/egg/acct_mgr/htfile.py", line 50, in set_password File "build/bdist.linux-i686/egg/acct_mgr/htfile.py", line 77, in _update_file File "/usr/lib/python2.4/fileinput.py", line 231, in next

line = self.readline()

File "/usr/lib/python2.4/fileinput.py", line 300, in readline

os.rename(self._filename, self._backupfilename)

OSError: [Errno 16] Das Gerät oder die Ressource ist belegt }}} Das Gerät oder die Ressource ist belegt means device or resource busy

I wonder where that might come from.

comment:3 Changed 9 years ago by Markus Tacker <m@…>

I'm sorry. The error above was what the fronted reported. This is in the apache error_log

PythonHandler trac.web.modpython_frontend: Traceback (most recent call last):
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch\n    result = object(req)
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/trac/web/modpython_frontend.py", line 87, in handler\n    gateway.run(dispatch_request)
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/trac/web/wsgi.py", line 87, in run\n    response = application(self.environ, self._start_response)
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 329, in dispatch_request\n    req.hdf['title'] = to_unicode(e) or 'Error'
PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/trac/util/__init__.py", line 108, in to_unicode\n    return ' '.join([unicode(arg) for arg in text.args])
PythonHandler trac.web.modpython_frontend: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)

comment:4 Changed 9 years ago by cboos

  • Milestone set to 0.10
  • Owner changed from jonas to cboos
  • Status changed from new to assigned

So apparently there are parts of Python which create localized error messages as str object with some encoding (the locale encoding?), and not using unicode objects for that.

Ok, so I think I'll have to apply the above patch.

(Btw, Markus, can you try to apply the patch, as from the line

PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/trac/util/__init__.py", line 108, in to_unicode\n    return ' '.join([unicode(arg) for arg in text.args])

it doesn't look that you applied it, it must be [to_unicode(arg) ... instead of [unicode(arg)...)

comment:5 Changed 9 years ago by cboos

  • Resolution set to fixed
  • Severity changed from normal to minor
  • Status changed from assigned to closed

Patch applied in r3296.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain cboos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from cboos to the specified user.

Add Comment


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

 
Note: See TracTickets for help on using tickets.