question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

python 2.7 torchtext 0.2.1

trying to build the vocab:

my_text.build_vocab(train, vectors=GloVe(name='840B', dim=300))

results in error:

  File "/home/noa/miniconda2/lib/python2.7/site-packages/torchtext/vocab.py", line 330, in __init__
    super(GloVe, self).__init__(name, url=url, **kwargs)
  File "/home/noa/miniconda2/lib/python2.7/site-packages/torchtext/vocab.py", line 223, in __init__
    self.cache(name, cache, url=url)
  File "/home/noa/miniconda2/lib/python2.7/site-packages/torchtext/vocab.py", line 251, in cache
    with zipfile.ZipFile(dest, "r") as zf:
  File "/home/noa/miniconda2/lib/python2.7/zipfile.py", line 770, in __init__
    self._RealGetContents()
  File "/home/noa/miniconda2/lib/python2.7/zipfile.py", line 813, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
MotorCityCobracommented, Apr 25, 2018

I found the glove.6B.zip file in about two seconds by entering

locate vector_cache

into my Terminal

4reactions
nelson-liucommented, Jan 8, 2018

Looks related to https://github.com/pytorch/text/issues/158. The easiest fix is to delete the GloVe zipfile and try again, it may be cached in /home/noa/miniconda2/lib/python2.7/site-packages/torchtext/.data/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python cant handle exceptions from zipfile.BadZipFile
In the code example underneath Im trying to catch the exception, so I can pass it. But my script is failing when the...
Read more >
Python Examples of zipfile.BadZipfile - ProgramCreek.com
The following are 30 code examples of zipfile.BadZipfile(). You can vote up the ones you like or vote down the ones you don't...
Read more >
zipfile — Work with ZIP archives — Python 3.11.1 documentation
The ZIP file format is a common archive and compression standard. This module provides tools to create, read, write, append, and list a...
Read more >
python 3.9 and opepyxl : Error "zipfile ... - Google Groups
Hi current configuration: python: 3.9 |openpyxl: 3.0.6 | pandas: 1.2.3 |xlrd 2.0.1. Running the function below I get the error "zipfile.BadZipFile: File is ......
Read more >
BadZipfile "file is not a zip file"
BadZipfile : File is not a zip file. When I look at data.zip in Windows, it appears to be a valid zip file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found