Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BadZipFile Error #148

Closed
Acaro12 opened this issue Dec 31, 2024 · 1 comment
Closed

BadZipFile Error #148

Acaro12 opened this issue Dec 31, 2024 · 1 comment

Comments

@Acaro12
Copy link

Acaro12 commented Dec 31, 2024

Hi,

I used this pipeline a year ago and got it working nicely in the end. However, when trying to analyze new data now using the IMC preprocessing script, I encounter the following error:


BadZipFile Traceback (most recent call last)
Cell In[20], line 10
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 ~/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 ~/miniconda3/envs/imcsegpipe/lib/python3.9/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 ~/miniconda3/envs/imcsegpipe/lib/python3.9/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

I ran the analysis using MacOS Sonoma as well as Linux/Ubuntu.
I compressed mcd+txt files using both above-mentioned systems with default compression but also using a third party tool on mac.
I updated conda, deleted the IMCsegmentationPipeline repository and cloned it again.
When I used the script to preprocess data from one year ago or your example data, everything worked nicely. However when I extracted your example data and zipped it again, the same error as above occurred.
None of the above worked - the same error persisted.

From the above I suspect that the error might be due to an old version of the imcsegpipe. When I tried to update the imcsegpipe python package using

pip install imcsegpipe --upgrade

, the following error was reported:

ERROR: Could not find a version that satisfies the requirement imcsegpipe (from versions: none)
ERROR: No matching distribution found for imcsegpipe

What could be the problem here?
Thank you in advance!

@Acaro12
Copy link
Author

Acaro12 commented Jan 4, 2025

Apparently, the fact that the .zip files were located on a ExFAT-formatted external SSD drive caused the problem...
Relocating them to the internal HD drive of the M3 Mac book solved the issue.

@Acaro12 Acaro12 closed this as completed Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant