Solved / Workaround – TypeError: iter_rows() got an unexpected keyword argument ‘row_offset’ –> Change Version of openpyxl

To resolve this error, change version of openpyxl

 

python -m pip install openpyxl==2.5

 

 

ERROR MESSAGE

Traceback (most recent call last):
  File "c:\Users\{username}\.vscode\extensions\ms-python.python-2019.10.44104\pythonFiles\ptvsd_launcher.py", line 43, in <module>
    main(ptvsdArgs)
  File "c:\Users\{username}\.vscode\extensions\ms-python.python-2019.10.44104\pythonFiles\lib\python\old_ptvsd\ptvsd\__main__.py", line 432, in main
    run()
  File "c:\Users\{username}\.vscode\extensions\ms-python.python-2019.10.44104\pythonFiles\lib\python\old_ptvsd\ptvsd\__main__.py", line 316, in run_file
    runpy.run_path(target, run_name='__main__')
  File "C:\opt\Python37-64\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\opt\Python37-64\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\opt\Python37-64\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "e:\work\code\01-dev\test.py", line 10, in <module>
    df = petl.todataframe(table=table1)
  File "C:\opt\Python37-64\lib\site-packages\petl\io\pandas.py", line 31, in todataframe
    l = list(table)
  File "C:\opt\Python37-64\lib\site-packages\petl\io\xlsx.py", line 63, in __iter__
    column_offset=self.column_offset)
TypeError: iter_rows() got an unexpected keyword argument 'row_offset'

 

Install Version 2.5 of  openpyxl

PS E:\work\code> python -m pip install openpyxl==2.5
Collecting openpyxl==2.5
  Downloading https://files.pythonhosted.org/packages/62/5d/82b7989dee698891ae3545b157fbbb1b345ec7f78be8167849156c71e71c/openpyxl-2.5.0.tar.gz (169kB)
     |████████████████████████████████| 174kB 6.8MB/s
Requirement already satisfied: jdcal in c:\opt\python37-64\lib\site-packages (from openpyxl==2.5) (1.4)
Requirement already satisfied: et_xmlfile in c:\opt\python37-64\lib\site-packages (from openpyxl==2.5) (1.0.1)
Building wheels for collected packages: openpyxl
  Building wheel for openpyxl (setup.py) ... done
  Created wheel for openpyxl: filename=openpyxl-2.5.0-py2.py3-none-any.whl size=236593 sha256=5886de220495947cb49b34411fac1e326a1e6375558af10c7076e1e4aa597dcf
  Stored in directory: C:\Users\dacostajN\AppData\Local\pip\Cache\wheels\56\e4\1d\cd5608f5018fe46960ed4d30c7137e9bfe9f5f394c01f20fc2
Successfully built openpyxl
Installing collected packages: openpyxl
  Found existing installation: openpyxl 2.6.2
    Uninstalling openpyxl-2.6.2:
      Successfully uninstalled openpyxl-2.6.2
Successfully installed openpyxl-2.5.0

 

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.