csingley / ofxtools

Python OFX Library
Other
303 stars 68 forks source link

ofxget: TypeError: object of type 'UUID' has no len() #13

Closed dkbarn closed 7 years ago

dkbarn commented 7 years ago

Just taking my first stab at downloading data using ofxget, and getting this error:

ofxget -u username https://vesnc.vanguard.com/us/OfxDirectConnectServlet --org "The Vanguard Group" --fid 1358 -n

Traceback (most recent call last):
  File "C:\Applications\Python27\Scripts\ofxget-script.py", line 11, in <module>
    load_entry_point('ofxtools==0.3.13', 'console_scripts', 'ofxget')()
  File "c:\applications\python27\lib\site-packages\ofxtools\Client.py", line 414, in main
    do_stmt(args)
  File "c:\applications\python27\lib\site-packages\ofxtools\Client.py", line 312, in do_stmt
    print(client.ofxheader + ET.tostring(request).decode())
  File "c:\applications\python27\lib\site-packages\ofxtools\Client.py", line 185, in ofxheader
    return str(OFXHeader(version=self.version, newfileuid=uuid.uuid4()))
  File "c:\applications\python27\lib\site-packages\ofxtools\header.py", line 139, in __init__
    newfileuid=newfileuid
  File "c:\applications\python27\lib\site-packages\ofxtools\header.py", line 51, in __init__
    self.newfileuid = newfileuid or 'NONE'
  File "c:\applications\python27\lib\site-packages\ofxtools\types.py", line 49, in __set__
    value = self.convert(value)
  File "c:\applications\python27\lib\site-packages\ofxtools\types.py", line 102, in convert
    if self.length is not None and len(value) > self.length:
TypeError: object of type 'UUID' has no len()
csingley commented 7 years ago

Yeah sorry I broke that in the 0.3.13 release. It was fixed in 1b2f469. I just haven't yet pushed another release to PyPi yet, pending some more significant changes.

Try installing the latest from Github, it works fine for me.

inteledyne commented 7 years ago

How do I actually access the ofxget command? Seems like I'm supposed to run the Client.py script with relevant options, but that doesn't seem to work either.

Any help would be greatly appreciated. Thanks again.

csingley commented 7 years ago

If you run setup.py it should install the ofxget command.

On Tue, Mar 21, 2017, 12:58 PM robintanner notifications@github.com wrote:

How do I actually access the ofxget command? Seems like I'm supposed to run the Client.py script with relevant options, but that doesn't seem to work either.

Any help would be greatly appreciated. Thanks again.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/csingley/ofxtools/issues/13#issuecomment-288199826, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYWlHwLHTKvNPfuIdS2d3pVl2_XHyw7ks5roCvpgaJpZM4LXsY5 .

inteledyne commented 7 years ago

Did that. No dice. Here's the install -

`C:\Users\robin\Documents\GitHub\ofxtools>python setup.py install --user running install running bdist_egg running egg_info writing top-level names to ofxtools.egg-info\top_level.txt writing ofxtools.egg-info\PKG-INFO writing dependency_links to ofxtools.egg-info\dependency_links.txt writing entry points to ofxtools.egg-info\entry_points.txt writing requirements to ofxtools.egg-info\requires.txt reading manifest file 'ofxtools.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching '*' under directory 'ofxtools\tests' writing manifest file 'ofxtools.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_py creating build\bdist.win-amd64\egg creating build\bdist.win-amd64\egg\ofxtools copying build\lib\ofxtools\Client.py -> build\bdist.win-amd64\egg\ofxtools creating build\bdist.win-amd64\egg\ofxtools\config copying build\lib\ofxtools\config\fi.cfg -> build\bdist.win-amd64\egg\ofxtools\config copying build\lib\ofxtools\config\ofxget_example.cfg -> build\bdist.win-amd64\egg\ofxtools\config copying build\lib\ofxtools\header.py -> build\bdist.win-amd64\egg\ofxtools copying build\lib\ofxtools\lib.py -> build\bdist.win-amd64\egg\ofxtools copying build\lib\ofxtools\models.py -> build\bdist.win-amd64\egg\ofxtools creating build\bdist.win-amd64\egg\ofxtools\ofxalchemy copying build\lib\ofxtools\ofxalchemy\database.py -> build\bdist.win-amd64\egg\ofxtools\ofxalchemy copying build\lib\ofxtools\ofxalchemy\models.py -> build\bdist.win-amd64\egg\ofxtools\ofxalchemy copying build\lib\ofxtools\ofxalchemy\Parser.py -> build\bdist.win-amd64\egg\ofxtools\ofxalchemy copying build\lib\ofxtools\ofxalchemy\Types.py -> build\bdist.win-amd64\egg\ofxtools\ofxalchemy copying build\lib\ofxtools\ofxalchemy__init.py -> build\bdist.win-amd64\egg\ofxtools\ofxalchemy copying build\lib\ofxtools\Parser.py -> build\bdist.win-amd64\egg\ofxtools copying build\lib\ofxtools\Response.py -> build\bdist.win-amd64\egg\ofxtools copying build\lib\ofxtools\Types.py -> build\bdist.win-amd64\egg\ofxtools copying build\lib\ofxtools\utils.py -> build\bdist.win-amd64\egg\ofxtools copying build\lib\ofxtools\init.py -> build\bdist.win-amd64\egg\ofxtools byte-compiling build\bdist.win-amd64\egg\ofxtools\Client.py to Client.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\header.py to header.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\lib.py to lib.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\models.py to models.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\ofxalchemy\database.py to database.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\ofxalchemy\models.py to models.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\ofxalchemy\Parser.py to Parser.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\ofxalchemy\Types.py to Types.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\ofxalchemy\init.py to init.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\Parser.py to Parser.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\Response.py to Response.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\Types.py to Types.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\utils.py to utils.cpython-34.pyc byte-compiling build\bdist.win-amd64\egg\ofxtools\init.py to init.cpython-34.pyc creating build\bdist.win-amd64\egg\EGG-INFO copying ofxtools.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO copying ofxtools.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO copying ofxtools.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO copying ofxtools.egg-info\entry_points.txt -> build\bdist.win-amd64\egg\EGG-INFO copying ofxtools.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO copying ofxtools.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO zip_safe flag not set; analyzing archive contents... ofxtools.pycache.Client.cpython-34: module references file__ creating 'dist\ofxtools-0.3.13-py3.4.egg' and adding 'build\bdist.win-amd64\egg' to it removing 'build\bdist.win-amd64\egg' (and everything under it) Processing ofxtools-0.3.13-py3.4.egg removing 'c:\users\robin\appdata\roaming\python\python34\site-packages\ofxtools-0.3.13-py3.4.egg' (and everything under it) creating c:\users\robin\appdata\roaming\python\python34\site-packages\ofxtools-0.3.13-py3.4.egg Extracting ofxtools-0.3.13-py3.4.egg to c:\users\robin\appdata\roaming\python\python34\site-packages ofxtools 0.3.13 is already the active version in easy-install.pth Installing ofxget-script.py script to C:\Users\robin\AppData\Roaming\Python\Scripts Installing ofxget.exe script to C:\Users\robin\AppData\Roaming\Python\Scripts

Installed c:\users\robin\appdata\roaming\python\python34\site-packages\ofxtools-0.3.13-py3.4.egg Processing dependencies for ofxtools==0.3.13 Searching for requests==2.7.0 Best match: requests 2.7.0 Adding requests 2.7.0 to easy-install.pth file

Using c:\python34\lib\site-packages Finished processing dependencies for ofxtools==0.3.13

C:\Users\robin\Documents\GitHub\ofxtools>ofxget 'ofxget' is not recognized as an internal or external command, operable program or batch file.

C:\Users\robin\Documents\GitHub\ofxtools> `

csingley commented 7 years ago

Installing ofxget.exe script to C:\Users\robin\AppData\Roaming\Python\Scripts

It says it's installed there; maybe that directory just isn't in your $PATH? Try going into that directory and executing it. I'm not too much help about Windows environment.

But now you've got me curious about how you've been running the code until now to generate the errors.

And I'm also wondering why it's not working for you to execute Client.py directly... it just executes the Client.main() function, which is exactly what the ofxget command does too; they're functionally identical. Maybe you just need to first invoke a python interpreter to feed the script into, i.e. python Client.py ? Cause I don't think Windows will respect the hash-bang at the top of the file involving /usr/bin/env/

These sound like environment problems.

inteledyne commented 7 years ago

When I try to run Client.py I get a file with the following message, but when I log into chase, I have no message from Chase.

C:\Users\robin\Documents\GitHub\ofxtools>python ofxtools\Client.py -u * --org chase -C -server https://ofx.chase.com --bankid 111000614 Password: Traceback (most recent call last): File "C:\Users\robin\AppData\Roaming\Python\Python34\site-packages\ofxtools-0.3.13-py3.4.egg\ofxtools\Types.py", line 249, in convert format = self.formats[len(value)] KeyError: 5

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "ofxtools\Client.py", line 412, in main() File "ofxtools\Client.py", line 408, in main do_stmt(args) File "ofxtools\Client.py", line 298, in do_stmt kwargs = {k:DateTime().convert(v) for k,v in d.items() if k.startswith('dt')} File "ofxtools\Client.py", line 298, in kwargs = {k:DateTime().convert(v) for k,v in d.items() if k.startswith('dt')} File "C:\Users\robin\AppData\Roaming\Python\Python34\site-packages\ofxtools-0.3.13-py3.4.egg\ofxtools\Types.py", line 252, in convert (orig_value, self.formats.values())) ValueError: Datetime 'erver' does not match OFX formats dict_values(['%Y%m%d', '%Y%m%d%H%M%S.%f', '%Y%m%d%H%M', '%Y%m%d%H%M%S'])

C:\Users\robin\Documents\GitHub\ofxtools>

When I execute with python27 I get this -

C:\Users\robin\Documents\GitHub\ofxtools>C:\Python27\python.exe ofxtools\Client.py -u robintanner9 --org chase -C 789814001 -server https://ofx.chase.com --bankid 111000614 Traceback (most recent call last): File "ofxtools\Client.py", line 38, in from ofxtools.header import OFXHeader ImportError: No module named ofxtools.header

C:\Users\robin\Documents\GitHub\ofxtools>

csingley commented 7 years ago

First, you've got a syntax error in the command. Try this:

python ofxtools\Client.py -u ***** --org chase -C **** --bankid 111000614 https://ofx.chase.com

See, [server] is a positional argument; you don't actually type that out. If you did type out a long-form argument, you need to prefix it with two dashes (not one). argparse is reading -server as -s erver, i.e. you're trying to set DTSTART='erver', which is of course a syntax error (DTSTART and DTEND are of the form YYYYMMDD). Just put the naked URL at the end of the command as a positional argument.

Second, you probably only have ofxtools installed as a python3 module, not also as a python2 module. Try running python2 setup.py and see where that gets you.

p5a0u9l commented 7 years ago

same issue with pypi install, will download/install from github

csingley commented 7 years ago

OK guys, I pushed a new release to pypi. Hopefully that will make life easier for everyone. Sorry for the delay.