captin411 / ofxclient

Bank transaction downloader and python OFX client libraries
MIT License
263 stars 89 forks source link

Traceback TypeError: must be char, not unicode #21

Open alpinel opened 8 years ago

alpinel commented 8 years ago

c:>ofxclient +---------------------------------- Main Edit C:\Users**\ofxclient.ini to change descriptions or ofx options +---------------------------------- (A) Add an account (Q) Quit choice> A +---------------------------------- Add account

+----------------------------------

Notice

You are about to search for bank connection information on a third party website. This means you are trusting http://ofxhome.com and their security policies.

You will be sending your bank name to this website.

bank name eg. "express" (enter to exit)> USAA (0) USAA Federal Savings Bank (1) USAA Investment Mgmt Co

choice> 0

Notice

You are about to test to make sure your username and password are correct. This means you will be sending it to the URL below. If the URL does not appear to belong to your bank then you should exit this program by hitting CTRL-C. bank name: USAA Federal Savings Bank

bank url: https://service2.usaa.com/ofx/OFXServlet

username> ** Traceback (most recent call last): File "C:\Python27\Scripts\ofxclient-script.py", line 9, in load_entry_point('ofxclient==2.0.1', 'console_scripts', 'ofxclient')() File "C:\Python27\lib\site-packages\ofxclient-2.0.1-py2.7.egg\ofxclient\cli.py", line 52, in run main_menu() File "C:\Python27\lib\site-packages\ofxclient-2.0.1-py2.7.egg\ofxclient\cli.py", line 72, in main_menu add_account_menu() File "C:\Python27\lib\site-packages\ofxclient-2.0.1-py2.7.egg\ofxclient\cli.py", line 119, in add_account_menu if login_check_menu(bank): File "C:\Python27\lib\site-packages\ofxclient-2.0.1-py2.7.egg\ofxclient\cli.py", line 185, in login_check_menu password = getpass.getpass('password> ') File "C:\Python27\lib\getpass.py", line 95, in win_getpass msvcrt.putch(c) TypeError: must be char, not unicode

ChromoX commented 8 years ago

Have you tried running with python 3?

captin411 commented 8 years ago

@alpinel thanks for the detailed error response. I have recently done a lot of work to get this library to work under python 3.

It appears that these changes may have broken things with python 2.7 on windows (I can not reproduce this on 2.7 on OSX or Linux).

Unfortunately, this will be troublesome for me to troubleshoot and correct as I do not have a copy of Windows today.

If it is not too much trouble, would you mind testing this same thing with python 3 (I Use 3.5) on windows?

tgoetze commented 8 years ago

This was fixed in other projects (see https://github.com/nishad/udemy-dl/pull/93/files ) by encoding the prompt value passed to getpass.getpass(). For example, the following gets past this issue:

        password = ''
        prompt_text = 'password> '
        if os.name == 'nt' and sys.version_info < (3, 0):
            prompt_text = prompt_text.encode('utf8')
        while not password:
            password = getpass.getpass(prompt=prompt_text)

You can directly change the file at: c:\Python27\Lib\site-packages\ofxclient-2.0.1-py2.7.egg\ofxclient\cli.py to get it working right away.

androclus commented 7 years ago

I don't know if mine is related or different, but I get a similar TypeError. If it looks too different, let me know, and I'll post a separate issue:

$ ofxclient
+----------------------------------
Main
Edit /home/jeff/ofxclient.ini to
change descriptions or ofx options
+----------------------------------
(A) Add an account
(Q) Quit
choice> A
+----------------------------------
Add account
+----------------------------------
------
Notice
------
You are about to search for bank connection information
on a third party website.  This means you are trusting
http://ofxhome.com and their security policies.

You will be sending your bank name to this website.
------
bank name eg. "express" (enter to exit)> xxxxxx
(0) XXXXXX
choice> 0
------
Notice
------
You are about to test to make sure your username and password
are correct.  This means you will be sending it to the URL below.
If the URL does not appear to belong to your bank then you should
exit this program by hitting CTRL-C.
  bank name: XXXXXX
  bank url:  https://xxx.xxxxxx.xxx
------
username> xxxxxxxxxx
password> 
password> 
authentication failed: User or Member password invalid
username> xxxxxxxxxx
password> 
+----------------------------------
Main
Edit /home/jeff/ofxclient.ini to
change descriptions or ofx options
+----------------------------------
Traceback (most recent call last):
  File "/usr/local/bin/ofxclient", line 11, in <module>
    load_entry_point('ofxclient==2.0.3', 'console_scripts', 'ofxclient')()
  File "/usr/local/lib/python2.7/dist-packages/ofxclient/cli.py", line 63, in run
    main_menu(args)
  File "/usr/local/lib/python2.7/dist-packages/ofxclient/cli.py", line 71, in main_menu
    accounts = GlobalConfig.accounts()
  File "/usr/local/lib/python2.7/dist-packages/ofxclient/config.py", line 216, in accounts
    for s in self.parser.sections()]
  File "/usr/local/lib/python2.7/dist-packages/ofxclient/config.py", line 301, in _section_to_account
    section_items = dict(self.parser.items(section))
  File "/usr/local/lib/python2.7/dist-packages/ofxclient/config.py", line 100, in items
    for k, v in ConfigParser.items(self, section):
  File "/usr/lib/python2.7/ConfigParser.py", line 655, in items
    for option in options]
  File "/usr/lib/python2.7/ConfigParser.py", line 663, in _interpolate
    if value and "%(" in value:
TypeError: argument of type 'int' is not iterable
$ _

I'm on Debian Jessie 8.8.0, and using a version of ofxclient (2.0.3) installed via pip. Python 2.7.9.

Let me know if there is any additional information I can supply.