[Boa Constr] Compiling a module on a non-ascii path - patch proposal
Status: Beta
Brought to you by:
riaan
From: Pavel R. <pav...@ti...> - 2006-12-30 22:45:51
|
Hi all, I have a problem while saving a Python module with a non-ascii path from Boa, as downloaded today, December 30th 2006, from the CVS. The traceback is in the attachment. So I tried to resolve it. I discovered that the "compile" function doesn't expect the filename parameter to be of type unicode but of the type str. The function converts it then to unicode for itself. If the filename is of type unicode and includes some non-ascii characters, then the .decode method - used in the "compile" function internally - fails. It also doesn't make sense to decode unicode to unicode. Therefore I tried to resolve it this way: In the file <boa-path>/ModRunner.py, class "CompileModuleRunner", function "run", before the line 65 I inserted: # If "filename" is passed as unicode, # we need to convert it back to the filesystem's encoding # because the "compile" function needs it so. import sys if type(filename) is unicode: filename = filename.encode(sys.getfilesystemencoding()) Please think about it and maybe some of the developers (greetings, Riaan :-) ) can consider if it's worth putting in the CVS source. Pavel Reznicek |