1542: postreview.py unhandled exception, line 659

rich****@gmai***** (Google Code) (Is this you? Claim this profile.)
March 11, 2010
What version are you running?
March 5th nightly of RBTools.

What's the URL of the page containing the problem?
N/A

What steps will reproduce the problem?
It seems to be related to the handling of non-ascii characters in a 
supposedly ASCII text file.  We have a file, 'tinystr.cpp' from the TinyXML 
distribution.  postreview.py seems to choke when encoding the line 
"THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005."
Specifically on the 'o' in Lovset.  This is obviously not an ascii 
character.  I'm currently removing this code from my source control, which 
is why I'm seeing this error now.

What is the expected output? What do you see instead?
It would be nice if:
1) The file post-reviewed anyway.
And at the very least I would expect
2) The rest of the files post-review, and I get a warning about this one, 
and what exactly is wrong with it, along with (hopefully) a notice on the 
review board server's website that the file changed and could not be 
posted.

The text of the stack is (note that this is running in pdb):
Traceback (most recent call last):
  File 
"p:\sa\ss\toolchain\python\export\2.6\2.6.2f0\tools\win32\i386\lib\pdb.py
", line 1283, in main
    pdb._runscript(mainpyfile)
  File 
"p:\sa\ss\toolchain\python\export\2.6\2.6.2f0\tools\win32\i386\lib\pdb.py
", line 1202, in _runscript
    self.run(statement)
  File 
"p:\sa\ss\toolchain\python\export\2.6\2.6.2f0\tools\win32\i386\lib\bdb.py
", line 368, in run
    exec cmd in globals, locals
  File "<string>", line 1, in <module>
  File "postreview.py", line 2809, in <module>
    main()
  File "postreview.py", line 2791, in main
    submit_as=options.submit_as)
  File "postreview.py", line 2497, in tempt_fate
    parent_diff_content)
  File "postreview.py", line 506, in upload_diff
    review_request['id'], fields, files)
  File "postreview.py", line 625, in api_post
    return self.process_json(self.http_post(path, fields, files))
  File "postreview.py", line 600, in http_post
    content_type, body = self._encode_multipart_formdata(fields, files)
  File "postreview.py", line 659, in _encode_multipart_formdata
    return content_type, content.encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf8 in position 
818872: ordinal not in range(128)

What operating system are you using? What browser?

I'm running postreview.py on Windows 7.

Please provide any additional information below.

This error did not happen with an older version of RBTools (I had reviewed 
adding this code to our source code control earlier, when we were thinking 
about using it).  I upgraded to this one to get a couple of other fixes, 
but ran into this instead.
chipx86
#1 chipx86
The change that caused this has been reverted in a more recent nightly.
  • +Fixed