-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 PhiLho wrote: > Public bug reported: > > I attempted to move a directory but apparently a file was locked and it triggered an error. The issue is that the error was in French with CP1252 characters (French accents) and Python was confused as the code page on the console is CP850 (I think, to be double checked...). > Here is what I got: > > E:\Dev\PhiLhoSoft\Processing\_QuickExperiments >> bzr version > Bazaar (bzr) 2.0.0 > Python interpreter: C:\PrgCmdLine\Bazaar\python25.dll 2.5.4 > Python standard library: C:\PrgCmdLine\Bazaar\lib\library.zip > Platform: Windows-XP-5.1.2600-SP3 > bzrlib: C:\PrgCmdLine\Bazaar\lib\library.zip\bzrlib > >> md IO > >> bzr add > adding _QuickExperiments/IO > adding _QuickExperiments/SaveAndLoadArray > adding _QuickExperiments/SaveAndLoadArray/SaveAndLoadArray.pde > >> bzr co -m "Shows how to save and load binary data" > Committing to: E:/Dev/PhiLhoSoft/Processing/ > added _QuickExperiments/IO > added _QuickExperiments/SaveAndLoadArray > added _QuickExperiments/SaveAndLoadArray/SaveAndLoadArray.pde > Committed revision 83. > >> bzr mv SaveAndLoadArray IO/. > bzr: ERROR: Unprintable exception BzrMoveFailedError: dict={'operator': ' =>', '_preformatted_string': None, 'from_path': u'SaveAndLoadArray', 'to_path': u'SaveAndLoadArray', 'extra': ': Le processus ne peut pas acc\xe9der au fichier car ce fichier est utilis\xe9 par un autre processus'}, fmt='Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s', error=UnicodeDecodeError('ascii', ':Le processus ne peut pas acc\xe9der au fichier car ce fichier est utilis\xe9 par un autre processus', 30, 31, 'ordinal not in range(128)') > > In .bzr.log: > > jeu. 2010-01-14 15:06:54 +0100 > 0.140 bzr arguments: [u'mv', u'SaveAndLoadArray', u'IO/.'] > 0.171 looking for plugins in E:/Dev/PhiLhoSoft/settings/bazaar/2.0/plugins > 0.250 looking for plugins in C:/PrgCmdLine/Bazaar/plugins > 0.406 encoding stdout as sys.stdout encoding 'cp850' > 0.484 opening working tree 'E:/Dev/PhiLhoSoft/Processing' > 0.546 Traceback (most recent call last): > File "bzrlib\commands.pyo", line 842, in exception_to_return_code > File "bzrlib\commands.pyo", line 1037, in run_bzr > File "bzrlib\commands.pyo", line 654, in run_argv_aliases > File "bzrlib\builtins.pyo", line 808, in run > File "bzrlib\builtins.pyo", line 851, in _run > File "bzrlib\mutabletree.pyo", line 52, in tree_write_locked > File "bzrlib\workingtree_4.pyo", line 754, in move > BzrMoveFailedError: Unprintable exception BzrMoveFailedError: dict={'operator': ' =>', '_preformatted_string': None, 'from_path': u'SaveAndLoadArray', 'to_path': u'SaveAndLoadArray', 'extra': ': Le processus ne peut pas acc\xe9der au fichier car ce fichier est utilis\xe9 par un autre processus'}, fmt='Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s', error=UnicodeDecodeError('ascii', ': Le processus ne peut pas acc\xe9der au fichier car ce fichier est utilis\xe9 par un autre processus', 30, 31, 'ordinal not in range(128)') > > ** Affects: bzr > Importance: Undecided > Status: New > status: confirmed importance: medium tags: unicode I think the issue is that WindowsError is getting a non-ascii string, and we are trying to print it out using Unicode. (and thus cannot decode it). I think the best answer is probably to custom handle WindowsError and call FormatMessageW() which will give us a Unicode error string. Which we can then try to massage into printable form using .encode(, 'replace') or something along those lines. Also, we should probably be using "__unicode__" for our error message formatting rather than "__str__" because we know they will contain non-ascii information. (Either paths, or system error messages, etc.) John =:-> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktPTOMACgkQJdeBCYSNAAPrQQCeNEygxw/PE7hXMz0GfO9haSew xs4AoKhJkxSWihtWEQntNOnaWC5VwG5t =d3KF -----END PGP SIGNATURE-----