I'm extracting geodatabase replicas downloaded from ArcGIS Online from zip files. The script iterates across a json to drive the process. When this was in my C drive it executed smoothly. When I moved it to a network drive it failed on the 4th iteration, giving me a 'OSError: [Errno 22] Invalid argument' message relating to Zipfile.extractall(). The last half of the error message as the traceback leaves my script is at the end.
I am working in a ArcGIS Pro controlled conda environment, so few modules are the most current.
Thoughts? The exception handling seems to be solving the immediate problem and letting the script run as intended, but the error is just bugging me.
def gdb_extract(repzip,path):
with zipfile.ZipFile(repzip, 'r') as zip_ref:
fname = zip_ref.namelist()[0]
try:
zip_ref.extractall()#running into problems here
except Exception as e:
print(e.args)
fname=fname.split('/')[0]
fpath=path+'/'+fname
os.remove(repzip)
return fpath
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\zipfile.py", line 1636, in extractall self._extract_member(zipinfo, path, pwd) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\zipfile.py", line 1691, in _extract_member shutil.copyfileobj(source, target) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\shutil.py", line 82, in copyfileobj fdst.write(buf) OSError: [Errno 22] Invalid argument