做python开发,操作windows下的文件时经常遇到如下错误 :
IOError: [Errno N]
N表示的是错误号,如经常遇到的IOError: [Errno 2] , IOError: [Errno 5], IOError: [Errno 13]......
这里查了一下windows下的常用错误,这里归纳如下:
url: http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx
The operation completed successfully.
Incorrect function.
The system cannot find the file specified.
The system cannot find the path specified.
The system cannot open the file.
Access is denied.
The handle is invalid.
The storage control blocks were destroyed.
Not enough storage is available to process this command.
The storage control block address is invalid.
The environment is incorrect.
An attempt was made to load a program with an incorrect format.
The access code is invalid.
The data is invalid.
Not enough storage is available to complete this operation.
The system cannot find the drive specified.
The directory cannot be removed.
The system cannot move the file to a different disk drive.
There are no more files.
The media is write protected.
The system cannot find the device specified.
The device is not ready.
The device does not recognize the command.
Data error (cyclic redundancy check).
The program issued a command but the command length is incorrect.
The drive cannot locate a specific area or track on the disk.
The specified disk or diskette cannot be accessed.
The drive cannot find the sector requested.
The printer is out of paper.
The system cannot write to the specified device.
The system cannot read from the specified device.
A device attached to the system is not functioning.
The process cannot access the file because it is being used by another process.
The process cannot access the file because another process has locked a portion of the file.
The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.
Too many files opened for sharing.
Reached the end of the file.
The disk is full.
The request is not supported.
Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator.
You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name.
The network path was not found.
The network is busy.
The specified network resource or device is no longer available.
The network BIOS command limit has been reached.
A network adapter hardware error occurred.
The specified server cannot perform the requested operation.
An unexpected network error occurred.
The remote adapter is not compatible.
The printer queue is full.
Space to store the file waiting to be printed is not available on the server.
Your file waiting to be printed was deleted.
The specified network name is no longer available.
Network access is denied.
The network resource type is not correct.
The network name cannot be found.
The name limit for the local computer network adapter card was exceeded.
The network BIOS session limit was exceeded.
The remote server has been paused or is in the process of being started.
No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.
The specified printer or disk device has been paused.
The file exists.
The directory or file cannot be created.
Fail on INT 24.
Storage to process this request is not available.
The local device name is already in use.
The specified network password is not correct.
The parameter is incorrect.
A write fault occurred on the network.
The system cannot start another process at this time.
Cannot create another system semaphore.
The exclusive semaphore is owned by another process.
The semaphore is set and cannot be closed.
The semaphore cannot be set again.
Cannot request exclusive semaphores at interrupt time.
The previous ownership of this semaphore has ended.
Insert the diskette for drive %1.
The program stopped because an alternate diskette was not inserted.
The disk is in use or locked by another process.
The pipe has been ended.
The system cannot open the device or file specified.
The file name is too long.
There is not enough space on the disk.
No more internal file identifiers available.
The target internal file identifier is incorrect.
The IOCTL call made by the application program is not correct.
The verify-on-write switch parameter value is not correct.
The system does not support the command requested.
This function is not supported on this system.
The semaphore timeout period has expired.
The data area passed to a system call is too small.
The filename, directory name, or volume label syntax is incorrect.
The system call level is not correct.
The disk has no volume label.
The specified module could not be found.
The specified procedure could not be found.
There are no child processes to wait for.
The %1 application cannot be run in Win32 mode.
Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O.
An attempt was made to move the file pointer before the beginning of the file.
The file pointer cannot be set on the specified device or file.
A JOIN or SUBST command cannot be used for a drive that contains previously joined drives.
An attempt was made to use a JOIN or SUBST command on a drive that has already been joined.
An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted.
The system tried to delete the JOIN of a drive that is not joined.
The system tried to delete the substitution of a drive that is not substituted.
The system tried to join a drive to a directory on a joined drive.
The system tried to substitute a drive to a directory on a substituted drive.
The system tried to join a drive to a directory on a substituted drive.
The system tried to SUBST a drive to a directory on a joined drive.
The system cannot perform a JOIN or SUBST at this time.
The system cannot join or substitute a drive to or for a directory on the same drive.
The directory is not a subdirectory of the root directory.
The directory is not empty.
The path specified is being used in a substitute.
Not enough resources are available to process this command.
The path specified cannot be used at this time.
An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute.
System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
The number of specified semaphore events for DosMuxSemWait is not correct.
DosMuxSemWait did not execute; too many semaphores are already set.
The DosMuxSemWait list is not correct.
The volume label you entered exceeds the label character limit of the target file system.
Cannot create another thread.
The recipient process has refused the signal.
The segment is already discarded and cannot be locked.
The segment is already unlocked.
The address for the thread ID is not correct.
One or more arguments are not correct.
The specified path is invalid.
A signal is already pending.
No more threads can be created in the system.
Unable to lock a region of a file.
The requested resource is in use.
Device's command support detection is in progress.
A lock request was not outstanding for the supplied cancel region.
The file system does not support atomic changes to the lock type.
The system detected a segment number that was not correct.
The operating system cannot run %1.
Cannot create a file when that file already exists.
The flag passed is not correct.
The specified system semaphore name was not found.
The operating system cannot run %1.
The operating system cannot run %1.
The operating system cannot run %1.
Cannot run %1 in Win32 mode.
The operating system cannot run %1.
%1 is not a valid Win32 application.
The operating system cannot run %1.
The operating system cannot run %1.
The operating system cannot run this application program.
The operating system is not presently configured to run this application.
The operating system cannot run %1.
The operating system cannot run this application program.
The code segment cannot be greater than or equal to 64K.
The operating system cannot run %1.
The operating system cannot run %1.
The system could not find the environment option that was entered.
No process in the command subtree has a signal handler.
The filename or extension is too long.
The ring 2 stack is in use.
The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified.
The signal being posted is not correct.
The signal handler cannot be set.
The segment is locked and cannot be reallocated.
Too many dynamic-link modules are attached to this program or dynamic-link module.
Cannot nest calls to LoadModule.
This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
The image file %1 is signed, unable to modify.
The image file %1 is strong signed, unable to modify.
This file is checked out or locked for editing by another user.
The file must be checked out before saving changes.
The file type being saved or retrieved has been blocked.
The file size exceeds the limit allowed and cannot be saved.
Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically.
Operation did not complete successfully because the file contains a virus or potentially unwanted software.
This file contains a virus or potentially unwanted software and cannot be opened. Due to the nature of this virus or potentially unwanted software, the file has been removed from this location.
The pipe is local.
The pipe state is invalid.
All pipe instances are busy.
The pipe is being closed.
No process is on the other end of the pipe.
More data is available.
The session was canceled.
The specified extended attribute name was invalid.
The extended attributes are inconsistent.
The wait operation timed out.
No more data is available.
The copy functions cannot be used.
The directory name is invalid.
The extended attributes did not fit in the buffer.
The extended attribute file on the mounted file system is corrupt.
The extended attribute table file is full.
The specified extended attribute handle is invalid.
The mounted file system does not support extended attributes.
Attempt to release mutex not owned by caller.
Too many posts were made to a semaphore.
Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
The oplock request is denied.
An invalid oplock acknowledgment was received by the system.
The volume is too fragmented to complete this operation.
The file cannot be opened because it is in the process of being deleted.
Short name settings may not be changed on this volume due to the global registry setting.
Short names are not enabled on this volume.
The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume.
A requested file lock operation cannot be processed due to an invalid byte range.
The subsystem needed to support the image type is not present.
The specified file already has a notification GUID associated with it.
An invalid exception handler routine has been detected.
Duplicate privileges were specified for the token.
No ranges for the specified operation were able to be processed.
Operation is not allowed on a file system internal file.
The physical resources of this disk have been exhausted.
The token representing the data is invalid.
The device does not support the command feature.
The system cannot find message text for message number 0x%1 in the message file for %2.
The scope specified was not found.
The Central Access Policy specified is not defined on the target machine.
The Central Access Policy obtained from Active Directory is invalid.
The device is unreachable.
The target device has insufficient resources to complete the operation.
A data integrity checksum error occurred. Data in the file stream is corrupt.
An attempt was made to modify both a KERNEL and normal Extended Attribute (EA) in the same operation.
Device does not support file-level TRIM.
The command specified a data offset that does not align to the device's granularity/alignment.
The command specified an invalid field in its parameter list.
An operation is currently in progress with the device.
An attempt was made to send down the command via an invalid path to the target device.
The command specified a number of descriptors that exceeded the maximum supported by the device.
Scrub is disabled on the specified file.
The storage device does not provide redundancy.
An operation is not supported on a resident file.
An operation is not supported on a compressed file.
An operation is not supported on a directory.
The specified copy of the requested data could not be read.
No action was taken as a system reboot is required.
The shutdown operation failed.
The restart operation failed.
The maximum number of sessions has been reached.
The thread is already in background processing mode.
The thread is not in background processing mode.
The process is already in background processing mode.
The process is not in background processing mode.
Attempt to access invalid address.