Getting Parser Erros While Trying to Convert from CSV to OFX
I'm getting the following errors:
Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/meza/fntools.py", line 635, in byte bytes_ = content.encode(ENCODING) AttributeError: 'itertools.islice' object has no attribute 'encode'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 470, in _read_any for num, line in enumerate(reader(f, *args, **kwargs)): File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 825, in reader first_line = StringIO(str(next(f))) StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/csv2ofx/main.py", line 266, in run
res = write(dest, IterStringIO(content), **kwargs)
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 1503, in write
return sum(read_any(filepath, writer, mode, content, **kwargs))
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 545, in read_any
for line in _read_any(filepath, reader, args, **kwargs):
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 470, in _read_any
for num, line in enumerate(reader(f, *args, **kwargs)):
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 1481, in writer
for chunk in ft.chunk(content, chunksize):
File "/usr/local/lib/python3.10/dist-packages/meza/fntools.py", line 671, in
This is when I run the '-d' option:
{'account_type': None, 'chunksize': 16384, 'collapse': None, 'custom': None, 'dayfirst': False, 'debug': True, 'dest': 'monthly-statement_01-Jun-2024_24-Jun-2024.ofx', 'encoding': 'utf-8', 'end': '2024-06-24 16:18:39.101245', 'first_col': 0, 'first_row': 0, 'language': 'ENG', 'last_row': inf, 'list_mappings': False, 'mapping': 'default', 'overwrite': False, 'qif': False, 'server_date': None, 'source': 'monthly-statement_01-Jun-2024_24-Jun-2024.csv', 'start': None, 'verbose': False, 'version': False}
Montly Statement Revolut
- I have a Ubuntu 22.04.4 LTS Server runnig, I have installed the
csv2ofxtool. - But when I run the tool I get the following messages:
zoran@unifisrv:~/csv2oxf$ csv2ofx monthly-statement_01-Jun-2024_04-Jul-2024.csv monthly-statement_01-Jun-2024_04-Jul-2024.ofx
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
- If I try again with the
-coption I get the following result:
zoran@unifisrv:~/csv2oxf$ csv2ofx -c monthly-statement_01-Jun-2024_04-Jul-2024.csv monthly-statement_01-Jun-2024_04-Jul-2024.ofx
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/meza/fntools.py", line 635, in byte
bytes_ = content.encode(ENCODING)
AttributeError: 'itertools.islice' object has no attribute 'encode'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 470, in _read_any
for num, line in enumerate(reader(f, *args, **kwargs)):
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 825, in reader
first_line = StringIO(str(next(f)))
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/csv2ofx/main.py", line 266, in run
res = write(dest, IterStringIO(content), **kwargs)
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 1503, in write
return sum(read_any(filepath, writer, mode, content, **kwargs))
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 545, in read_any
for line in _read_any(filepath, reader, args, **kwargs):
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 470, in _read_any
for num, line in enumerate(reader(f, *args, **kwargs)):
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 1481, in writer
for chunk in ft.chunk(content, chunksize):
File "/usr/local/lib/python3.10/dist-packages/meza/fntools.py", line 671, in <genexpr>
generator = (content.read(chunksize) for _ in it.count())
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 148, in read
return self._read(self.iter, num, newline=False)
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 132, in _read
byte = ft.byte(content)
File "/usr/local/lib/python3.10/dist-packages/meza/fntools.py", line 640, in byte
bytes_ = b"".join(map(encode, content))
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 65, in <genexpr>
encode = lambda iterable: (s.encode(ENCODING) for s in iterable)
File "/usr/local/lib/python3.10/dist-packages/csv2ofx/ofx.py", line 445, in gen_body
for datum in data:
File "/usr/local/lib/python3.10/dist-packages/csv2ofx/utils.py", line 175, in gen_data
for group, main_pos, sorted_trxns in groups:
File "/usr/local/lib/python3.10/dist-packages/csv2ofx/__init__.py", line 309, in clean_trxns
for grp, trxns in groups:
File "/usr/local/lib/python3.10/dist-packages/csv2ofx/__init__.py", line 295, in gen_trxns
for grp, transactions in groups:
File "/usr/local/lib/python3.10/dist-packages/csv2ofx/ofx.py", line 480, in gen_groups
for chnk in chunk(records, chunksize):
File "/usr/local/lib/python3.10/dist-packages/meza/fntools.py", line 686, in <genexpr>
generator = (list(it.islice(i, chunksize)) for _ in it.count())
File "/usr/local/lib/python3.10/dist-packages/meza/io.py", line 545, in read_any
for line in _read_any(filepath, reader, args, **kwargs):
RuntimeError: generator raised StopIteration
zoran@unifisrv:~/csv2oxf$
Could you please help me out?
Regards
Zoran
I have tried severl different mappings with different output results. Only none of them worked.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m default monthly-statement_01-Jun-2024_04-Jul-2024.csv
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m rabobank monthly-statement_01-Jun-2024_04-Jul-2024.csv
Field 'IBAN/BBAN' is missing from file. Check `mapping` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m n26 monthly-statement_01-Jun-2024_04-Jul-2024.csv
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m abnamro monthly-statement_01-Jun-2024_04-Jul-2024.csv
Field 'field_0' is missing from file. Check `mapping` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m bnp monthly-statement_01-Jun-2024_04-Jul-2024.csv
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m boursorama monthly-statement_01-Jun-2024_04-Jul-2024.csv
Field 'accountNum' is missing from file. Check `mapping` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m capitalone monthly-statement_01-Jun-2024_04-Jul-2024.csv
Field 'Card No.' is missing from file. Check `mapping` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m creditunion monthly-statement_01-Jun-2024_04-Jul-2024.csv
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m custom monthly-statement_01-Jun-2024_04-Jul-2024.csv
Field 'Field' is missing from file. Check `mapping` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m yodlee monthly-statement_01-Jun-2024_04-Jul-2024.csv
Field 'Transaction Id' is missing from file. Check `mapping` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m xero monthly-statement_01-Jun-2024_04-Jul-2024.csv
Field 'JournalNumber' is missing from file. Check `mapping` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m ubs monthly-statement_01-Jun-2024_04-Jul-2024.csv
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m stripe monthly-statement_01-Jun-2024_04-Jul-2024.csv
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m starling monthly-statement_01-Jun-2024_04-Jul-2024.csv
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m split_account monthly-statement_01-Jun-2024_04-Jul-2024.csv
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m mint monthly-statement_01-Jun-2024_04-Jul-2024.csv
Field 'Account Name' is missing from file. Check `mapping` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m exim monthly-statement_01-Jun-2024_04-Jul-2024.csv
No data to write. Parser must be a string or character stream, not NoneType. Try again with `-c` option.
zoran@unifisrv:~/csv2oxf$ csv2ofx -m outbank monthly-statement_01-Jun-2024_04-Jul-2024.csv
Field 'Account' is missing from file. Check `mapping` option.
Can you share a sample CSV that produces unexpected output?
Thank you for your answer, due to the fact that Revolut has changed their conditions regarding Business Accounts it was cheaper for me to get an account at a local bank which have a build-in export option to OFX
Thank you for reminding me that this issue still was open !
Kind Regards