Instapy: zipfile.BadZipFile: File is not a zip file

Created on 25 Aug 2019  路  7Comments  路  Source: timgrossmann/InstaPy

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\bastocheAppData\Local\Programs\Python\Python37lib\site-packagesinstapyinstapy.py", line 318, in __init__
self.logger,
File "C:Users\bastocheAppData\Local\Programs\Python\Python37lib\site-packagesinstapy\browser.py", line 110, in set_selenium_local_session
driver_path = geckodriver_path or get_geckodriver()
File "C:Users\bastocheAppData\Local\Programs\Python\Python37lib\site-packagesinstapy\browser.py", line 36, in get_geckodriver
bin_path, sym_path = gdd.download_and_install()
File "C:Users\bastocheAppData\Local\Programs\Python\Python37lib\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\bastocheAppData\Local\Programs\Python\Python37lib\zipfile.py", line 1222, in __init__
self._RealGetContents()
File "C:Users\bastocheAppData\Local\Programs\Python\Python37lib\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 ?

wontfix

Most helpful comment

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

All 7 comments

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\JoepAppData\Local\Programs\Python\Python37-32\Lib\site-packagesInstaPy\quickstart.py", line 30, in
headless_browser=False)
File "C:Users\JoepAppData\Local\Programs\Python\Python37-32\Lib\site-packagesInstaPyinstapyinstapy.py", line 318, in __init__
self.logger,
File "C:Users\JoepAppData\Local\Programs\Python\Python37-32\Lib\site-packagesInstaPyinstapy\browser.py", line 110, in set_selenium_local_session
driver_path = geckodriver_path or get_geckodriver()
File "C:Users\JoepAppData\Local\Programs\Python\Python37-32\Lib\site-packagesInstaPyinstapy\browser.py", line 36, in get_geckodriver
bin_path, sym_path = gdd.download_and_install()
File "C:Users\JoepAppData\Local\Programs\Python\Python37-32lib\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\JoepAppData\Local\Programs\Python\Python37-32lib\zipfile.py", line 1225, in __init__
self._RealGetContents()
File "C:Users\JoepAppData\Local\Programs\Python\Python37-32lib\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.

Same error here !

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

same error here
windows 10

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

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

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\bastocheAppData\Local\Programs\Python\Python37lib\site-packagesinstapyinstapy.py", line 318, in init
self.logger,
File "C:Users\bastocheAppData\Local\Programs\Python\Python37lib\site-packagesinstapy\browser.py", line 110, in set_selenium_local_session
driver_path = geckodriver_path or get_geckodriver()
File "C:Users\bastocheAppData\Local\Programs\Python\Python37lib\site-packagesinstapy\browser.py", line 36, in get_geckodriver
bin_path, sym_path = gdd.download_and_install()
File "C:Users\bastocheAppData\Local\Programs\Python\Python37lib\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\bastocheAppData\Local\Programs\Python\Python37lib\zipfile.py", line 1222, in init
self._RealGetContents()
File "C:Users\bastocheAppData\Local\Programs\Python\Python37lib\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]
Was this page helpful?
0 / 5 - 0 ratings

Related issues

CodeMaster1 picture CodeMaster1  路  3Comments

wyvers picture wyvers  路  3Comments

harrypython picture harrypython  路  3Comments

converge picture converge  路  3Comments

seuraltimez picture seuraltimez  路  3Comments