I continue to have problems writing an ArcPro ArcToolBox tool script that takes as input 'multiple' files to be geoprocessed. To get right to the point, here is a code snippet:
def main():
gzipFiles = arcpy.GetParameterAsText(0)
myGzipFiles = gzipFiles.split(';')
for myGzipFileThatReallyExists in myGzipFiles:
gz = gzip.open(myGzipFileThatReallyExists, 'r') <-------FileNotFoundError..blah...blah...
gzContent = gz.read()
doMyGeoProcessing(gzContent)
gz.close()
The script fails in the above "gzip.open" statement with:
FileNotFoundError: [Errno 2] No such file or directory: "'C:\\MyFileReallyDoesExistHere.csv.gz'".
Note, I realize that there might be an issue with formatting the path to the gzip file in the loop (gzipFile), but I have exhausted trying everything with string.format, pathlib, os.path, etc. Note 2, the code works when I deselect the File input parameter "Multiple values" and adjust the code to:
def main():
gzipFile = arcpy.GetParameterAsText(0)
gz = gzip.open(gzipFile, 'r') <------- WORKS !?!?!?!?
gzContent = gz.read()
doMyGeoProcessing(gzContent)
gz.close()
This problem is very similar to problems I encountered decompressing KMZ files IN A FOR LOOP using:
zipfile..ZipFile(kmzFileThatReallyDoesExistVariable, 'r') <---------FileNotFounError...blah....blah
Any suggestion is greatly appreciated. This shouldn't be this hard to do!!!!
V/R