BodenmillerGroup / ImcSegmentationPipeline

A pixel classification based multiplexed image segmentation pipeline
https://bodenmillergroup.github.io/ImcSegmentationPipeline/
MIT License
84 stars 35 forks source link

BadZipFile error #96

Closed Jeffchingg closed 2 years ago

Jeffchingg commented 2 years ago

any help with the following error? I am running example downloaded. in the step to convert .MCD to .ome.tiff, it gave error message "bad zip files'.


BadZipFile Traceback (most recent call last) Input In [7], in <cell line: 3>() 8 temp_dirs.append(temp_dir) 9 for zip_file in sorted(zip_files): ---> 10 imcsegpipe.extract_zip_file(zip_file, temp_dir.name) 11 acquisition_metadatas = [] 12 for raw_dir in raw_dirs + [Path(temp_dir.name) for temp_dir in temp_dirs]:

File c:\users\jchen23\documents\imcsegmentationpipeline\src\imcsegpipe_imcsegpipe.py:23, in extract_zip_file(zip_file, dest_dir) 20 def extract_zip_file( 21 zip_file: Union[str, PathLike], dest_dir: Union[str, PathLike] 22 ) -> None: ---> 23 with ZipFile(zip_file, allowZip64=True) as f: 24 f.extractall(dest_dir)

File ~\AppData\Local\Continuum\anaconda3\envs\imcsegpipe\lib\zipfile.py:1266, in ZipFile.init(self, file, mode, compression, allowZip64, compresslevel, strict_timestamps) 1264 try: 1265 if mode == 'r': -> 1266 self._RealGetContents() 1267 elif mode in ('w', 'x'): 1268 # set the modified flag so central directory gets written 1269 # even if no files are added to the archive 1270 self._didModify = True

File ~\AppData\Local\Continuum\anaconda3\envs\imcsegpipe\lib\zipfile.py:1333, in ZipFile._RealGetContents(self) 1331 raise BadZipFile("File is not a zip file") 1332 if not endrec: -> 1333 raise BadZipFile("File is not a zip file") 1334 if self.debug > 1: 1335 print(endrec)

BadZipFile: File is not a zip file

nilseling commented 2 years ago

Hi @Jeffchingg could you please check that the ZIP files were correctly downloaded from here? For example, check that the file size matches. Just in case, could you please manually download the files and store them in theraw folder? I was able to reproduce this error with an incorrectly downloaded Patient4.zip file.

Jeffchingg commented 2 years ago

Thank you @nilseling, it works now after I followed your suggestion.