InstaPy icon indicating copy to clipboard operation
InstaPy copied to clipboard

zipfile.BadZipFile: File is not a zip file

Open Bastochee opened this issue 7 years ago • 7 comments

Hello everyone,

I'm on Windows. InstaPy was working perfectly until I got the "ensure chromedriver is installed" error. Downgrading chromedriver to a version between 71 and 75 wasn't fixing the issue.

I updated InstaPy, and pip. Now I have the following error :

File ".\simple_but_effective.py", line 18, in multi_logs=True) File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\site-packages\instapy\instapy.py", line 318, in init self.logger, File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\site-packages\instapy\browser.py", line 110, in set_selenium_local_session driver_path = geckodriver_path or get_geckodriver() File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\site-packages\instapy\browser.py", line 36, in get_geckodriver bin_path, sym_path = gdd.download_and_install() File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\site-packages\webdriverdownloader\webdriverdownloader.py", line 168, in download_and_install with zipfile.ZipFile(os.path.join(self.get_download_path(version), filename), mode="r") as driver_zipfile: File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\zipfile.py", line 1222, in init self._RealGetContents() File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\zipfile.py", line 1289, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

Anyone know what can be the issue ?

Bastochee avatar Aug 25 '19 04:08 Bastochee

Got the same issue rigth now, litteraly been going from one error to another. There has to come some improvement on the installing process for sure..

Traceback (most recent call last): File "C:\Users\Joep\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\InstaPy\quickstart.py", line 30, in headless_browser=False) File "C:\Users\Joep\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\InstaPy\instapy\instapy.py", line 318, in init self.logger, File "C:\Users\Joep\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\InstaPy\instapy\browser.py", line 110, in set_selenium_local_session driver_path = geckodriver_path or get_geckodriver() File "C:\Users\Joep\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\InstaPy\instapy\browser.py", line 36, in get_geckodriver bin_path, sym_path = gdd.download_and_install() File "C:\Users\Joep\AppData\Local\Programs\Python\Python37-32\lib\site-packages\webdriverdownloader\webdriverdownloader.py", line 168, in download_and_install with zipfile.ZipFile(os.path.join(self.get_download_path(version), filename), mode="r") as driver_zipfile: File "C:\Users\Joep\AppData\Local\Programs\Python\Python37-32\lib\zipfile.py", line 1225, in init self._RealGetContents() File "C:\Users\Joep\AppData\Local\Programs\Python\Python37-32\lib\zipfile.py", line 1292, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

This isssue came after i put my geckodriver in the InstaPy folder.

Hope someone is able to fix this or atleast tell me how to fix it.

Joepbever avatar Aug 25 '19 20:08 Joepbever

Same error here !

NooriP avatar Aug 28 '19 15:08 NooriP

The same here!

Traceback (most recent call last): File "C:\Users\victo\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\quickstart.py.txt", line 29, in <module> headless_browser=True) File "C:\Users\victo\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\instapy\instapy.py", line 318, in __init__ self.logger, File "C:\Users\victo\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\instapy\browser.py", line 110, in set_selenium_local_session driver_path = geckodriver_path or get_geckodriver() File "C:\Users\victo\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\instapy\browser.py", line 36, in get_geckodriver bin_path, sym_path = gdd.download_and_install() File "C:\Users\victo\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\webdriverdownloader\webdriverdownloader.py", line 168, in download_and_install with zipfile.ZipFile(os.path.join(self.get_download_path(version), filename), mode="r") as driver_zipfile: File "C:\Users\victo\AppData\Local\Programs\Python\Python37-32\lib\zipfile.py", line 1225, in __init__ self._RealGetContents() File "C:\Users\victo\AppData\Local\Programs\Python\Python37-32\lib\zipfile.py", line 1292, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

VICPAR1996 avatar Aug 29 '19 21:08 VICPAR1996

same error here windows 10

Mee1ad avatar Sep 02 '19 14:09 Mee1ad

Go into your user folder (ex. C:\Users\Bob\InstaPy\assets and remove the geckodriver zip and folder. Then try your script again.

trevarj avatar Sep 03 '19 20:09 trevarj

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

stale[bot] avatar Oct 03 '19 21:10 stale[bot]

Hello everyone,

I'm on Windows. InstaPy was working perfectly until I got the "ensure chromedriver is installed" error. Downgrading chromedriver to a version between 71 and 75 wasn't fixing the issue.

I updated InstaPy, and pip. Now I have the following error :

File ".\simple_but_effective.py", line 18, in multi_logs=True) File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\site-packages\instapy\instapy.py", line 318, in init self.logger, File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\site-packages\instapy\browser.py", line 110, in set_selenium_local_session driver_path = geckodriver_path or get_geckodriver() File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\site-packages\instapy\browser.py", line 36, in get_geckodriver bin_path, sym_path = gdd.download_and_install() File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\site-packages\webdriverdownloader\webdriverdownloader.py", line 168, in download_and_install with zipfile.ZipFile(os.path.join(self.get_download_path(version), filename), mode="r") as driver_zipfile: File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\zipfile.py", line 1222, in init self._RealGetContents() File "C:\Users\bastoche\AppData\Local\Programs\Python\Python37\lib\zipfile.py", line 1289, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

Anyone know what can be the issue ?

I get the same issue, it works fine in Colabs to call for remote bzip data to be downloaded and placed into a dataloader code block 1), but when using the exact same line of code in an ipython / jupyter notebook (code block 2) on the local machine it returns the above error (full code to replicate error shown):

Code block 1 in colabs (here) -- WORKS

Inputs:

import torch
from torchtext import data
from torchtext import datasets
import random

SEED = 1234

torch.manual_seed(SEED)
torch.backends.cudnn.deterministic = True

TEXT = data.Field(tokenize = 'spacy')
LABEL = data.LabelField()

train_data, test_data = datasets.TREC.splits(TEXT, LABEL, fine_grained=False)

train_data, valid_data = train_data.split(random_state = random.seed(SEED))

MAX_VOCAB_SIZE = 25_000

TEXT.build_vocab(train_data, 
                 max_size = MAX_VOCAB_SIZE, 
                 vectors = "glove.6B.100d", 
                 unk_init = torch.Tensor.normal_)

LABEL.build_vocab(train_data)

Outputs:

downloading train_5500.label
train_5500.label: 100%|██████████| 336k/336k [00:00<00:00, 1.26MB/s]
downloading TREC_10.label
TREC_10.label: 100%|██████████| 23.4k/23.4k [00:00<00:00, 365kB/s]
.vector_cache/glove.6B.zip: 862MB [06:28, 2.22MB/s]                           
100%|█████████▉| 399770/400000 [00:18<00:00, 21376.57it/s]

a1ultima avatar Nov 23 '20 11:11 a1ultima