[Windows] Logging breaks on unicode
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Phatch |
Fix Released
|
High
|
Stani |
Bug Description
Run the badge action on the tests/input/*.jpg file with this branch:
https:/
Important: this is an error during logging so it won't be logged and as such not registered by the test suite!
>python app.py
Traceback (most recent call last):
File "C:\Python25\
self.
File "C:\Python25\
return self.writer.
File "C:\Python25\
data, consumed = self.encode(object, self.errors)
File "C:\Python25\
return codecs.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 133: ordina
l not in range(128)
Related branches
summary: |
- Logging breaks on unicode + [Windows] Logging breaks on unicode |
description: | updated |
tags: | added: windows |
This is probably not the best fix. So feel free to improve it. But at least now unicode filenames now can get logged and don't vanish from the test suite.
=== modified file 'phatch/ core/api. py' pformat( action. dump()) unicode( WARN_MESSAGE % { warn(details) warn(unicode( encode( ENCODING, 'replace' ), LOG_COUNTER += 1
--- phatch/core/api.py 2010-03-18 03:51:30 +0000
+++ phatch/core/api.py 2010-03-18 04:50:22 +0000
@@ -145,13 +145,17 @@
return
if action:
action = pprint.
- details = WARN_MESSAGE % {
+ details = ensure_
'number': WARNING_LOG_COUNTER + 1,
'message': message,
'input': input,
'action': action,
- }
- logging.
+ })
+ logging.
+ details.
+ ENCODING,
+ 'replace'
+ ))
WARNING_
return details
@@ -177,15 +181,20 @@
traceback_ details = ensure_ unicode( traceback. format_ exc()) unicode( message) unicode( ERROR_MESSAGE % { error(details) error(unicode( encode( ENCODING, 'replace' ), LOG_COUNTER += 1
if exception:
else:
- traceback_details = ''
- details = ERROR_MESSAGE % {
+ traceback_details = ''
+ message = ensure_
+ details = ensure_
'number': ERROR_LOG_COUNTER + 1,
'message': message,
'input': input,
'action': action,
'details': traceback_details,
- }
- logging.
+ })
+ logging.
+ details.
+ ENCODING,
+ 'replace'
+ ))
ERROR_
if show:
# keep this for last as in console mode phatch quits on an error