I've got an iso-8859-1 encoded filename on linux that has characters
above 127. When pykaraoke tries to scan it, it borks because the
filename can't be encoded in python's default filesystem encoding.

Basically, the problem comes down to a combination of:
1) I believe you can either install wxPython with unicode set or
non-unicode. I have unicode set, so all wx* functions return unicode
objects.
2) Due to #1, the directories to be scanned are unicode objects, and
when listdir() is called on a unicode, it attempts to decode all
filenames that are returned using the filesystem's default encoding,
but this causes an exception which currently goes unhandled and just
crashes pykaraoke.

I have attached a patch which converts all directory names to str
objects before scanning them. It makes thing work here. I have not
tested it out on other platforms, but I believe since I remain with
str objects, all encoding issues should be effectively bypassed, so it
should work everywhere.

-Matt
diff -U4 -r -x '*pyc' pykaraoke-0.7.3/pykdb.py pykaraoke-0.7.3-patched/pykdb.py
--- pykaraoke-0.7.3/pykdb.py	2010-05-11 16:15:18.000000000 -0400
+++ pykaraoke-0.7.3-patched/pykdb.py	2010-12-04 00:52:02.235129110 -0500
@@ -1326,9 +1326,12 @@
         self.lastBusyUpdate = time.time()
         self.filesByFullpath = {}
 
         for i in range(len(fileList)):
-            root_path = fileList[i]
+            # Make sure root_path is a str and not a unicode or bad
+            # things happen on if any filename can't be encoded in the
+            # default python filesystem encoding.
+            root_path = str(fileList[i])
 
             # Assemble a stack of progress amounts through the various
             # directory levels.  This way we can update a progress bar
             # without knowing exactly how many directories we are
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Pykaraoke-discuss mailing list
Pykaraoke-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pykaraoke-discuss

Reply via email to