Using proteus to automate import of bank statement

I’m trying to use proteus to automate importation of bank statements on a nightly basis.
Looks that I need some hint, how to analyze the following problem.

While looking at the conversation between native client and backend i’ve timbered the following script:

from proteus import config, Model, Wizard, Report
import base64

conf = config.set_xmlrpc('http://<Username>:<Password>@<Hostname>:<Port>/<Database>/')

## Open Statement Import Wizard
stmt_wiz = Wizard('account.statement.import')

## Load OFX
data = open("/<path>/<to>/<file>/2021-03-01.DExxyyyyyyyyzzzzzzzz00.camt.booked.ofx", "r").read()
encoded = base64.b64encode(data.encode())
stmt_wiz.form.file_ = encoded

## Set file format
stmt_wiz.form.file_format = 'ofx'

##      Start import
r = stmt_wiz.execute('import_')

which is leading to the following error:

Traceback (most recent call last):
  File "/srv/tryton/edp.60.int/script/automated.import_statement_ofx.py", line 32, in <module>
    r = stmt_wiz.execute('import_')
  File "/srv/tryton/edp.60.int/venv/lib/python3.7/site-packages/proteus/__init__.py", line 1234, in execute
    ctx)
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1154, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1170, in single_request
    return self.parse_response(resp)
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1342, in parse_response
    return u.close()
  File "/usr/lib/python3.7/xmlrpc/client.py", line 656, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <**Fault 255: 'not enough values to unpack (expected 2, got 1)**'>

I am helpless to determine, which value I am missing.
Any help is appreciated

Chris

Hi, take a look to the scenario test of the module, maybe it helps:

https://hg.tryton.org/modules/account_statement_ofx/file/tip/tests/scenario_account_statement_ofx.rst#l86
Best Udo

Bad way to load the ofx.

Works so much better when doing this way:
statement_import.form.file_ = io.open(’////2021-03-01.DExxyyyyyyyyzzzzzzzz00.camt.booked.ofx’, ‘rb’, encoding=None).read()

Perfect! Thank you @udono!