|
|
| <prev next> |
Choosing A Webhost: |
Codeville 0.1.14 client.py comment encoding error and patch: msg#00013version-control.codeville.devel
The Codeville 0.1.14 is working fine on my Windows systems, but every attempt to run "cdv commit" on my iBook running OS X Tiger dies horribly: $ cdv commit -n Traceback (most recent call last): File "/usr/local/bin/cdv", line 512, in run retval = command[0](co, optlist, args) File "/usr/local/bin/cdv", line 178, in run_commit return commit(co, remote, comment, tstamp=tstamp, backup=backup, files=args) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/Codeville/client.py", line 1164, in commit comment = comment.decode(enc).encode("utf8") TypeError: decode() argument 1 must be string, not None While looking through the recent posts on this list regarding unknown encodings, I decided to find this errant line and see what the all the fuss might be about. It turns out this line appears twice in client.py in nearly identical blocks of text, one that begins on line 1074: try: lang, enc = locale.getdefaultlocale() if enc is None: enc = 'ascii' comment = comment.decode(enc).encode("utf8") and the other on line 1162: try: lang, enc = locale.getdefaultlocale() comment = comment.decode(enc).encode("utf8") Easily enough, copying the "if enc is None:" lines from the first block and pasting them into the second works around the problem. This error appears to arise as a result of many different operating systems getting their internationalization attempts muddled, to say the least: On Windows: C:\>python -c "import locale; print locale.getdefaultlocale()" ('en_US', 'cp1252') On OS X Tiger: $ python -c 'import locale; print locale.getdefaultlocale()' (None, None) The Python interpreter may someday be able to intelligently obtain detailed locale information from OS X despite its resistance, but it seems quite lacking at the moment. Having client.py default to ASCII is fine for me, but others will need to find a better way to get their own locale info into Python. Toby
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Re: Unknown encoding after 0.1.14, Yoshinori K. Okuji |
|---|---|
| Previous by Thread: | Unknown encoding after 0.1.14, Luis Otero |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |