Skip to content

Reading zipped utf-16 file: AttributeError: 'UTF8Recoder' object has no attribute 'seek'  #18071

Closed
@nickeubank

Description

@nickeubank

Code Sample, a copy-pastable example if possible

df = pd.read_table('myfile.zip', 
                   compression='zip',
                   encoding='utf-16')

Problem description

  Traceback (most recent call last):

 File "<ipython-input-4-6daea174e70a>", line 3, in <module>
  encoding='utf-16')

File "/Users/Nick/anaconda/lib/python3.5/site-packages/pandas/io/parsers.py", line 705, in parser_f
  return _read(filepath_or_buffer, kwds)

File "/Users/Nick/anaconda/lib/python3.5/site-packages/pandas/io/parsers.py", line 445, in _read
  parser = TextFileReader(filepath_or_buffer, **kwds)

File "/Users/Nick/anaconda/lib/python3.5/site-packages/pandas/io/parsers.py", line 814, in __init__
  self._make_engine(self.engine)

File "/Users/Nick/anaconda/lib/python3.5/site-packages/pandas/io/parsers.py", line 1045, in _make_engine
  self._engine = CParserWrapper(self.f, **self.options)

File "/Users/Nick/anaconda/lib/python3.5/site-packages/pandas/io/parsers.py", line 1684, in __init__
  self._reader = parsers.TextReader(src, **kwds)

File "pandas/_libs/parsers.pyx", line 391, in pandas._libs.parsers.TextReader.__cinit__

File "pandas/_libs/parsers.pyx", line 664, in pandas._libs.parsers.TextReader._setup_parser_source

File "/Users/Nick/anaconda/lib/python3.5/zipfile.py", line 1026, in __init__
  self._RealGetContents()

File "/Users/Nick/anaconda/lib/python3.5/zipfile.py", line 1090, in _RealGetContents
  endrec = _EndRecData(fp)

File "/Users/Nick/anaconda/lib/python3.5/zipfile.py", line 241, in _EndRecData
  fpin.seek(0, 2)

 AttributeError: 'UTF8Recoder' object has no attribute 'seek'

Expected Output

A table!

Output of pd.show_versions()

pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.5.3.final.0
python-bits: 64
OS: Darwin
OS-release: 16.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.21.0
pytest: 3.0.7
pip: 9.0.1
setuptools: 33.1.1.post20170320
Cython: 0.25.2
numpy: 1.11.3
scipy: 0.19.0
pyarrow: None
xarray: None
IPython: 5.3.0
sphinx: 1.5.4
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2016.10
blosc: None
bottleneck: 1.2.0
tables: 3.3.0
numexpr: 2.6.2
feather: None
matplotlib: 1.5.1
openpyxl: 2.4.5
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.6
lxml: 3.7.3
bs4: 4.5.3
html5lib: 0.999
sqlalchemy: 1.1.5
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext lo64)
jinja2: 2.9.5
s3fs: 0.0.9
fastparquet: None
pandas_gbq: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions