I opened two issues regarding copyfileobj that were not bugs, but a fix that was involved helped me figure out I needed a new external drive, since it displayed the error number from the copyfileobj function. I’d like a modified version of this code implemented permanently in shutil.py so others could see if they have the same issue as me. Here are the two issues I opened:
This is the original issue that has the code I was using that Eryksun posted.
Here’s the second issue where it happened again. I put the error message in this post, so you can see how it helped me. Also, the code might need to be modified slightly, since it generated an error.
Eriksun said the following to me about this. Maybe he’ll add more:
The ctypes code that I provided was only for debugging purposes.
Python needs to support the C runtime’s _doserrno value (actually it’s a Windows error code) internally for I/O calls such as _wopen(), close(), read(), and write().
Also, the error that you encountered, ERROR_NO_SUCH_DEVICE (433), should be mapped to the C errno value ENOENT (i.e. FileNotFoundError) in PC/errmap.h.