Strange IO Error when extracting zips to a network location

Hari Sekhon harisekhon at gmail.com
Wed May 17 07:37:29 EDT 2006


I put a try-pass around the line "outfile.write(zip.read(x)) " so that 
everything extracts regardless.

After extraction I checked the file size of every single file in the 
directory tree and only 2 files on the network drive are of different 
size to the ones extracted locally.

Both these files are .dbf files that are over 100MB when extracted. Both 
of them is short by exactly 4 KB.

Strange.

I wonder if I'm hitting a size limit or something with this "zipfile" 
module, or perhaps a python limitation on buffer or something?

I've change the code to

contents=zip.read(x)
outfile.write(contents)

but I still get the same result.

-h

Hari Sekhon wrote:
> Hi,
>   I've written a script to run on windows to extract all zips under a 
> given directory path to another directory path as such:
>
> python extractzips.py <fetch all zips under this dir> <put all 
> extracted files under this dir>
>
> The purpose of this script is to retrieve backup files which are 
> individually zipped under a backup directory tree on a backup server.
>
> This scripts works nicely and has input validation etc, exiting 
> gracefully and telling you if you gave a non existent start or target 
> path...
>
> When running the script as follows
>
> python extractzips.py \\backupserver\backupshare\machine\folder 
> d:\unziphere
>
> the script works perfectly, but if I do
>
> python extractzips.py \\backupserver\backupshare\machine\folder 
> \\anetworkmachine\share\folder
>
> then it unzips a lot of files, recreating the directory tree as it 
> goes but eventually fails with the traceback:
>
>  File "extractzips.py", line 41, in zipextract
>    outfile.write(zip.read(x))
> IOError: [Errno 22] Invalid argument
>
>
> But I'm sure the code is correct and the argument is passed properly, 
> otherwise a hundred files before it wouldn't have extracted 
> successfully using this exact same piece of code (it loops over it). 
> It always fails on this same file every time. When I extract the same 
> tree to my local drive it works fine without error.
>
> I have no idea why pushing to a network share causes an IO Error, 
> shouldn't it be the same as extracting locally from our perspective?
>
> It pulls fine, why doesn't it push fine?
>
>
> Thanks for any help or suggestions anybody can give me.
>
> Hari
>



More information about the Python-list mailing list