reubano / csv2ofx

A Python library and command line tool for converting csv to ofx and qif files
MIT License
199 stars 113 forks source link

ImportError: cannot import name 'utils' from 'csv2ofx' #73

Closed tschinz closed 2 years ago

tschinz commented 4 years ago
import csv2ofx

returnes the following error:

ImportError: cannot import name 'utils' from 'csv2ofx'

Running on python 3.7.6

csv2ofx installed via pip

anyone with the same issue

niklasden commented 3 years ago

Same issue here.

Running on python 3.6.4

Did you ever find out what the issue was?

tschinz commented 3 years ago

unfortunately no, abandon the use of this module and wrote an own csv2csv converter which worked for me.

niklasden commented 3 years ago

@tschinz not sure if this is relevant to you anymore, but I think I found a fix. For me it was required to call the module like this python -m csv2ofx.main.... instead of python main.py It seems to be a issue related to relative imports in python.

reubano commented 3 years ago

@tschinz @niklasden Can you provide a complete example? From my testing just now...

macOS 10.15.7

$ pip install csv2ofx
...
$ csv2ofx -V
v0.27.0
$ csv2ofx -h
usage: csv2ofx [options] <source> <dest>

description: csv2ofx converts a csv file to ofx and qif
...
$ python
...
>>> import csv2ofx
>>> csv2ofx
<module 'csv2ofx' from '/Users/reubano/.virtualenvs/py37/lib/python3.7/site-packages/csv2ofx/__init__.py'>
reubano commented 3 years ago

Also, see https://github.com/reubano/csv2ofx#usage

niklasden commented 3 years ago

@reubano I think there might be a slight misunderstanding on my end here. I was referring to running a changed version of your pip package.

I wanted to run my local "development" version of your module, because I created a new mapping. What would be the best practice for that?

Version 1 run from (/csv2ofx/csv2ofx/) - this does not work for me

(csv2ofx):$ python main.py -oq data/test/default.csv\
Traceback (most recent call last):\
File “main.py”, line 47, in \
from . import utils\
ImportError: cannot import name ‘utils’

Leads to the same error as described by @tschinz

Version 2 run from (/csv2ofx) - this works for me just fine.

(csv2ofx):$ python -m csv2ofx.main -oq data/test/default.csv
!Account 
NCash  
TCash  
^ 
!Type:Cash  
NINV-7  
D03/24/15  
PTchênzema Tchênzema  
T45000.00  
.....  
^
Python 3.6.4 (default, Nov 10 2020, 19:26:14) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
reubano commented 2 years ago

@niklasden glad you got it working. Feel to submit a PR with updates to the CUSTOMIZATION section of the readme.