Crashing Bazaar with a French Windows system :)

Philippe Lhoste PhiLho at GMX.net
Thu Jan 14 20:34:50 GMT 2010


On 14/01/2010 19:54, John Arbash Meinel wrote:
> So to understand what is going on, you can try running
>
> python
>>>> import ctypes.wintypes, os, sys
>>>> [...]

Ah, I didn't understood it was in interactive mode, I pasted the code 
above in a .py file and tried to run it, but not much result... :)
I knew the various lines with e. were suspicious! ;)

OK, here goes:

D:\_PhiLhoSoft
 > python Test.py

D:\_PhiLhoSoft
 > python
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import ctypes.wintypes, os, sys
 >>> f = open('file.txt', 'wb')
 >>> try:
...   os.rename('file.txt', 'new_file.txt')
... except WindowsError, e:
...   pass
...
 >>> e
WindowsError(32, 'Le processus ne peut pas acc\xe9der au fichier car ce 
fichier est utilis\xe9 par un autre processus')
 >>> e.errno
13
 >>> e.winerror
32
 >>>
 >>> e.strerror
'Le processus ne peut pas acc\xe9der au fichier car ce fichier est 
utilis\xe9 par un autre processus'
 >>> e.args
(32, 'Le processus ne peut pas acc\xe9der au fichier car ce fichier est 
utilis\xe9 par un autre processus')
 >>> f = ctypes.windll.kernel32.FormatMessageW
 >>> l = ctypes.windll.kernel32.LocalFree
 >>> res_buf = ctypes.wintypes.LPWSTR()
 >>> f(0x100 | 0x200 | 0x1000, # ALLOCATE_BUFFER | IGNORE_INSERTS | 
FROM_SYSTEM
...   None, e.winerror, 0x01<<10, # user langage (0x00 is NEUTRAL)
...   ctypes.byref(res_buf), 0, None)
96
 >>> res_buf.value
u'Le processus ne peut pas acc\xe9der au fichier car ce fichier est 
utilis\xe9 par un autre processus.\r\n'
 >>> l(res_buf)
0
 >>> quit()

 > python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
[snip]
import operator # builtin
# D:\Languages\Python\lib\encodings\cp1252.pyc matches 
D:\Languages\Python\lib\encodings\cp1252.py
import encodings.cp1252 # precompiled from 
D:\Languages\Python\lib\encodings\cp1252.pyc
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit 
(Intel)] on win32

> Sounds reasonable, though it really does fall more under the Support option.

It won't hurt to be on both sections, I think. :)

-- 
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --




More information about the bazaar mailing list