Python API: tokenizing error when using variant KPI in query


Hi all,

We’re experimenting with the Python API and things as pulling and pushing data works, however when I run the following code:

q_variant = Query()
#TODO internal error when adding the variants...
df_variants = datamodel.query(q_variant)

I get:
Traceback (most recent call last):

  File "<ipython-input-217-4922802c21ba>", line 1, in <module>
    df_variants = datamodel.query(q_variant)

  File "C:\dev\Anaconda\lib\site-packages\celonis_tools\model\", line 1843, in query
    return execution.fetch_result(encoding=encoding, **kw)

  File "C:\dev\Anaconda\lib\site-packages\celonis_tools\model\", line 1580, in fetch_result
    df = pd.read_csv(tmp_filename, **kw)

  File "C:\dev\Anaconda\lib\site-packages\pandas\io\", line 678, in parser_f
    return _read(filepath_or_buffer, kwds)

  File "C:\dev\Anaconda\lib\site-packages\pandas\io\", line 446, in _read
    data =

  File "C:\dev\Anaconda\lib\site-packages\pandas\io\", line 1036, in read
    ret =

  File "C:\dev\Anaconda\lib\site-packages\pandas\io\", line 1848, in read
    data =

  File "pandas\_libs\parsers.pyx", line 876, in

  File "pandas\_libs\parsers.pyx", line 891, in pandas._libs.parsers.TextReader._read_low_memory

  File "pandas\_libs\parsers.pyx", line 945, in pandas._libs.parsers.TextReader._read_rows

  File "pandas\_libs\parsers.pyx", line 932, in pandas._libs.parsers.TextReader._tokenize_rows

  File "pandas\_libs\parsers.pyx", line 2112, in pandas._libs.parsers.raise_parser_error

ParserError: Error tokenizing data. C error: Expected 26 fields in line 28, saw 28

We’re using Celonis 4.4, Python 3.7 and the Python library as downloaded last week from
We did not install the PyOrc package, b/c we’re using Python 3.7, could this be related?



You’re right! This is related to not using pyorcloader. We highly recommend doing all data transfer related tasks by first installing pyorcloader when using Celonis Process Mining 4.3 or 4.4. Downgrading to Python 3.6 or upgrading Celonis Process Mining to 4.5 would be the best short term solution.



Thanks Simon for the quick and clear reply, we’ll wait until our sys admins upgrade to 4.5 :slight_smile: