Search code examples
python-3.xpdfpycharmtabulatabula-py

Expected type 'dict', for 'str' instead PyCharm. Trying to convert all PDF pages into CSV using tabula?


my code can convert only one upper part of my PDF first sheet, when I am tying to convert all pages I can't because I get the error in my code.

import tabula

tabula.convert_into("/Users/gfidarov/Desktop/Python/KH_Profilansicht_13.11.2019-2.pdf", "/Users/gfidarov/Desktop/Python/test.csv", output_format="csv",pages='all')

The error which I get is about the pages function

when I am writing it PyCharm says Expected type 'dict', for 'str' instead

I am using python 3.x version in my PyCharm.

Is there other ways how to choose all pages to convert not only upper side of first page


Solution

  • Do you have a runtime error? PyCharm complain is just a warning one can "safely" ignore. The problem is tabula.convert_into has an incorrect docstring type annotation:

    kwargs (dict)
    

    should be e.g.

    kwargs (str)
    

    See https://www.python.org/dev/peps/pep-0484/#arbitrary-argument-lists-and-default-argument-values