New submission from Dum Dum:
On Windows 8.1 64-bit, using a fresh installation of Python 3.5.150.0 64-bit,
`error_script.py` crashes, while Python 3.4.3150 and 2.7.10150 (both 64-bit)
run the script properly.
Here is a traceback: https://bpaste.net/show/3ecfbf93b96e
--
files:
Dum Dum added the comment:
I rewrote the code following your suggestions and it appears the error was
indeed on my side. I somewhat expected that, but found it weird that it only
seemed to occur on 3.5. Thank you!
--
___
Python tracker
eryksun added the comment:
The default function pointer restype is c_int, and the default integer argument
conversion is also c_int. However, the handle returned by FindFirstVolume is a
pointer to a private structure that it uses for the volume enumeration, so you
must set restype to a
eryksun added the comment:
Here's a rewrite with a cleaner while loop, at least to me:
def list_volumes():
vname = ctypes.create_unicode_buffer(wintypes.MAX_PATH)
vhandle = kernel32.FindFirstVolumeW(vname, len(vname))
if vhandle == INVALID_HANDLE_VALUE: