[New-bugs-announce] [issue30194] AttributeError on opening ZipFile

Jacob B report at bugs.python.org
Thu Apr 27 21:15:03 EDT 2017


New submission from Jacob B:

The error occurs when I attempt to run the following code:

from urllib.request import urlretrieve
from os import path
from zipfile import ZipFile

download_url = "https://www.dropbox.com/s/obiqvrt4m53pmoz/tesseract-4.0.0-alpha.zip?dl=1"


def setup_program():
    zip_name = urlretrieve(download_url)

    zip_file = ZipFile(zip_name, "r")
    zip_file.extractall(path.abspath("__tesseract/"))
    zip_file.close()

setup_program()  # REMOVE after test


I get the following traceback:

$ python downloader.py
Traceback (most recent call last):
  File "downloader.py", line 15, in <module>
    setup_program()
  File "downloader.py", line 11, in setup_program
    zip_file = ZipFile(zip_name, "r")
  File "C:\Python36\lib\zipfile.py", line 1100, in __init__
    self._RealGetContents()
  File "C:\Python36\lib\zipfile.py", line 1163, in _RealGetContents
    endrec = _EndRecData(fp)
  File "C:\Python36\lib\zipfile.py", line 241, in _EndRecData
    fpin.seek(0, 2)
AttributeError: 'tuple' object has no attribute 'seek'

----------
messages: 292494
nosy: Jacob B2
priority: normal
severity: normal
status: open
title: AttributeError on opening ZipFile
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30194>
_______________________________________


More information about the New-bugs-announce mailing list