Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd client is not able to parse arguments correctly #46

Open
chbndrhnns opened this issue Jul 15, 2017 · 11 comments
Open

cmd client is not able to parse arguments correctly #46

chbndrhnns opened this issue Jul 15, 2017 · 11 comments

Comments

@chbndrhnns
Copy link

Here is the next issue:

pynynab ofximport --email bla --password bla --budgetname bla (no ofx file given)

seem to use ofximport as file name:

Traceback (most recent call last):
  File "/Users/jo/.virtualenvs/m2ynab/bin/pynynab", line 11, in <module>
    load_entry_point('pynYNAB===dev', 'console_scripts', 'pynynab')()
  File "/Users/jo/.virtualenvs/m2ynab/lib/python2.7/site-packages/pynYNAB-dev-py2.7.egg/pynYNAB/__main__.py", line 127, in main
    MainCommands()
  File "/Users/jo/.virtualenvs/m2ynab/lib/python2.7/site-packages/pynYNAB-dev-py2.7.egg/pynYNAB/__main__.py", line 62, in __init__
    getattr(self, args.command)()
  File "/Users/jo/.virtualenvs/m2ynab/lib/python2.7/site-packages/pynYNAB-dev-py2.7.egg/pynYNAB/__main__.py", line 110, in ofximport
    delta = do_ofximport(args,client)
  File "/Users/jo/.virtualenvs/m2ynab/lib/python2.7/site-packages/pynYNAB-dev-py2.7.egg/pynYNAB/scripts/ofximport.py", line 17, in do_ofximport
    tree.parse(args.ofxfile,codec='cp1252')
  File "/Users/jo/.virtualenvs/m2ynab/lib/python2.7/site-packages/ofxtools-0.5-py2.7.egg/ofxtools/Parser.py", line 31, in parse
    source = self._read(source, codec)  # Now it's a string
  File "/Users/jo/.virtualenvs/m2ynab/lib/python2.7/site-packages/ofxtools-0.5-py2.7.egg/ofxtools/Parser.py", line 68, in _read
    source = open(source, 'rb')
IOError: [Errno 2] No such file or directory: 'ofximport'

pynynab ofximport --email bla --password bla --budgetname bla sample.ofx

fails with

pynYNAB OFX import
usage: pynynab [-h] [--email Email] [--password Password]
               [--budgetname BudgetName]
               OFXPath
pynynab: error: unrecognized arguments: sample.ofx

My ynab.conf in the working directory is ignored.

@rienafairefr
Copy link
Owner

Thanks for the detailed info. I really need to revise the interface.

@chbndrhnns
Copy link
Author

yeah, I am trying to incorporate your module into my own module.

@rienafairefr
Copy link
Owner

if you're building in python, it's probably easier to directly import the do_ofximport/do_csvimport functions instead of using the CLI interface I think. just pass it an object with email,password,budgetname attributes

@rienafairefr
Copy link
Owner

OK I think I found the problem, just pushed 3d3c305 , there was a missing sys.argv.pop to remove the command (ofximport or csvimport).

@chbndrhnns
Copy link
Author

chbndrhnns commented Jul 17, 2017

No, not yet.
I needed to add to ofximport.py

import logging
logging.basicConfig()

to get the error messages working on cmd. After that, i still get the following message:

pynynab ofximport --email a --password b --budgetname c sample.ofx
pynYNAB OFX import
usage: pynynab [-h] [--email Email] [--password Password]
               [--budgetname BudgetName]
               OFXPath
pynynab: error: unrecognized arguments: sample.ofx

@rienafairefr
Copy link
Owner

Logging, logging.basicConfig() in main added in the latest changes

This case pynynab ofximport --email a --password b --budgetname c sample.ofx should be covered by the test_scripts, test_command_do_ofximport. Are you sure about which version is set up in your env/virtualenv or whatever ?

@chbndrhnns
Copy link
Author

chbndrhnns commented Jul 17, 2017

Logging is indeed fixed, but the second error in #46 (comment) still exists with 1a58943.

@rienafairefr
Copy link
Owner

which python version ?

@chbndrhnns
Copy link
Author

chbndrhnns commented Jul 17, 2017

2.7.13 and 3.6

@rienafairefr
Copy link
Owner

how did you install pynynab and its entrypoint ?

@chbndrhnns
Copy link
Author

chbndrhnns commented Jul 17, 2017

I uninstalled all pip version of pynynab, cloned the repo, created a virtual environment using mkvirtualenv, did python setup.py build; python setup.py install and verified via which pynynab that the correct version (in the virtual environment) is called.

Is something wrong with doing it that way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants