Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Codeville 0.1.14 client.py comment encoding error and patch: msg#00013

version-control.codeville.devel

Subject: Codeville 0.1.14 client.py comment encoding error and patch

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>
Google Custom Search

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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

Navigation