Skip to content

download_lahman() failing  #391

@double-dose-larry

Description

@double-dose-larry

Hi All,

I'm running pybaseball 2.2.7

I'm trying to run pybaseball.people() and getting the following stack trace:

---------------------------------------------------------------------------
BadZipFile                                Traceback (most recent call last)
Cell In[12], line 1
----> 1 download_lahman()

File ~/.local/lib/python3.10/site-packages/pybaseball/lahman.py:30, in download_lahman()
     28 def download_lahman():
     29     # download entire lahman db to present working directory
---> 30     z = get_lahman_zip()
     31     if z is not None:
     32         z.extractall(cache.config.cache_directory)

File ~/.local/lib/python3.10/site-packages/pybaseball/lahman.py:25, in get_lahman_zip()
     23 elif not _handle:
     24     s = requests.get(url, stream=True)
---> 25     _handle = ZipFile(BytesIO(s.content))
     26 return _handle

File /usr/lib/python3.10/zipfile.py:1269, in ZipFile.__init__(self, file, mode, compression, allowZip64, compresslevel, strict_timestamps)
   1267 try:
   1268     if mode == 'r':
-> 1269         self._RealGetContents()
   1270     elif mode in ('w', 'x'):
   1271         # set the modified flag so central directory gets written
   1272         # even if no files are added to the archive
   1273         self._didModify = True

File /usr/lib/python3.10/zipfile.py:1336, in ZipFile._RealGetContents(self)
   1334     raise BadZipFile("File is not a zip file")
   1335 if not endrec:
-> 1336     raise BadZipFile("File is not a zip file")
   1337 if self.debug > 1:
   1338     print(endrec)

BadZipFile: File is not a zip file

I dug around and saw that the data is attempt to be retrieved from here :
https://github.com/chadwickbureau/baseballdatabank/archive/master.zip

That is leading to a dead link. Perhaps there was a change upstream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions