BlueBrain / MOOC-neurons-and-synapses-2017

Reference data for the "Simulation Neuroscience:Neurons and Synapses" Massive Online Open Course
Other
43 stars 26 forks source link

Week 6 NMC Portal zip L5_TTPC2_cADpyr232_1 #61

Closed AGuyNextDoor closed 3 years ago

AGuyNextDoor commented 3 years ago

Hello,

I'm trying to compile the "Week 6. NMC portal" on the collab HBP website jupyter notebook.

After running the function urllib.urlretrieve('https://bbp.epfl.ch/nmc-portal/documents/10184/1921755/L5_TTPC2_cADpyr232_1.zip/a058fc9c-6c67-417b-a65b-20742902ccbb','L5_TTPC2_cADpyr232_1'); I can check with a !ls command that the file has been properly downloaded.

-rw-r--r-- 1 jovyan users  246 Feb 10 09:12 L5_TTPC2_cADpyr232_1.zip

But when running the unzip function, I get the following error

BadZipfileTraceback (most recent call last)
<ipython-input-8-575a2c75b940> in <module>()
      1 import os, zipfile
----> 2 with zipfile.ZipFile('./L5_TTPC2_cADpyr232_1', 'r') as zip_file:
      3     zip_file.extractall('.')

/opt/conda/envs/python2/lib/python2.7/zipfile.pyc in __init__(self, file, mode, compression, allowZip64)
    768         try:
    769             if key == 'r':
--> 770                 self._RealGetContents()
    771             elif key == 'w':
    772                 # set the modified flag so central directory gets written

/opt/conda/envs/python2/lib/python2.7/zipfile.pyc in _RealGetContents(self)
    809             raise BadZipfile("File is not a zip file")
    810         if not endrec:
--> 811             raise BadZipfile, "File is not a zip file"
    812         if self.debug > 1:
    813             print endrec

BadZipfile: File is not a zip file

I tried some zip fix solutions, unzipping directly from the bash commands but without success...

antonelepfl commented 3 years ago

Thank you for reporting this issue. We will investigate.

Meanwhile, you can try to use the URL https://bbp.epfl.ch/nmc-portal/assets/documents/static/downloads-zip/L5_TTPC2_cADpyr232_1.zip

AGuyNextDoor commented 3 years ago

When using the URL I can the following error:

IOErrorTraceback (most recent call last)
<ipython-input-4-6fc98d7e4a4b> in <module>()
      1 import os, zipfile
      2 with zipfile.ZipFile('./L5_TTPC2_cADpyr232_1.zip', 'r') as zip_file:
----> 3     zip_file.extractall('.')

/opt/conda/envs/python2/lib/python2.7/zipfile.pyc in extractall(self, path, members, pwd)
   1038 
   1039         for zipinfo in members:
-> 1040             self.extract(zipinfo, path, pwd)
   1041 
   1042     def _extract_member(self, member, targetpath, pwd):

/opt/conda/envs/python2/lib/python2.7/zipfile.pyc in extract(self, member, path, pwd)
   1026             path = os.getcwd()
   1027 
-> 1028         return self._extract_member(member, path, pwd)
   1029 
   1030     def extractall(self, path=None, members=None, pwd=None):

/opt/conda/envs/python2/lib/python2.7/zipfile.pyc in _extract_member(self, member, targetpath, pwd)
   1081 
   1082         with self.open(member, pwd=pwd) as source, \
-> 1083              file(targetpath, "wb") as target:
   1084             shutil.copyfileobj(source, target)
   1085 

IOError: [Errno 20] Not a directory: 'L5_TTPC2_cADpyr232_1/biophysics.hoc'
AGuyNextDoor commented 3 years ago

It worked when downloading and then going directly with

!mkdir L5_TTPC2_cADpyr232_1
!unzip ./L5_TTPC2_cADpyr232_1.zip -d ./L5_TTPC2_cADpyr232_1

for the unzipping.

Can you confirm that this divergence won't impact the exercise resolution later on?

Thank you for your time.

AGuyNextDoor commented 3 years ago

Exact same problem with the final graded exercise in week 6 NMC portal

The link to download:

urllib.urlretrieve('https://bbp.epfl.ch/nmc-portal/documents/10184/1921829/L4_PC_cADpyr230_2.zip/db6924e5-82ba-4d2c-a5f2-a9f17b8808bf','L4_PC_cADpyr230_2.zip');

And same error message when trying to unzip it


BadZipfileTraceback (most recent call last)
<ipython-input-4-eff62935701a> in <module>()
      1 import os, zipfile
----> 2 with zipfile.ZipFile('L4_PC_cADpyr230_2.zip', 'r') as zip_file:
      3     zip_file.extractall('.')

/opt/conda/envs/python2/lib/python2.7/zipfile.pyc in __init__(self, file, mode, compression, allowZip64)
    768         try:
    769             if key == 'r':
--> 770                 self._RealGetContents()
    771             elif key == 'w':
    772                 # set the modified flag so central directory gets written

/opt/conda/envs/python2/lib/python2.7/zipfile.pyc in _RealGetContents(self)
    809             raise BadZipfile("File is not a zip file")
    810         if not endrec:
--> 811             raise BadZipfile, "File is not a zip file"
    812         if self.debug > 1:
    813             print endrec

BadZipfile: File is not a zip file
AGuyNextDoor commented 3 years ago

When trying to unzip it manually with

!unzip ./L4_PC_cADpyr230_2.zip 

I get this error

Archive:  ./L4_PC_cADpyr230_2.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of ./L4_PC_cADpyr230_2.zip or
        ./L4_PC_cADpyr230_2.zip.zip, and cannot find ./L4_PC_cADpyr230_2.zip.ZIP, period.
AGuyNextDoor commented 3 years ago

(this error is solved by the pull request #63, I added the message for later reference)