jgillick / LendingClubAutoInvestor

A simple command line tool that will automatically invest all cash that becomes available
MIT License
47 stars 21 forks source link

Failed trying to invest: global name 'LendingClubError' is not defined #12

Closed snikolaev closed 10 years ago

snikolaev commented 10 years ago

Hi Jeremy,

Thanks for your product.

I am having this issue. I am hoping you could help. See the output below.

movie@muvi:~$ lcinvestor --version lcinvestor 2.1.1 movie@muvi:~$ uname -a Linux muvi 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:26 UTC 2013 i686 i686 i386 GNU/Linux movie@muvi:~$ python --version Python 2.7.3 movie@muvi:~$ lcinvestor --config=etc/investing.json --email=email@gmail.com --pass=pass

///--------------------------- $$$ ---------------------------\ | Welcome to the unofficial Lending Club investment tool |


Authenticated successfully! You have $403.75 in your account, free to invest

Now that you're signed in, let's define what you want to do

========= Prior Settings ========= Invest ALL available funds...

With at LEAST $125 available to invest Select a portfolio with an average interest rate between 15% - 30% Invest as much as $125 per loan note Add investments to: "Autoinvested"

Advanced filters:

Would you like to use these settings from last time? [Y/n]: y

That's all we need. Now, as long as this is running, your account will be checked every 60 minutes and invested if enough funds are available.

INFO: 2013-09-02 19:11 - Authenticated INFO: 2013-09-02 19:11 - Checking for funds to invest... INFO: 2013-09-02 19:11 - $ $ $ $ $ $ $ $ $ $ INFO: 2013-09-02 19:11 - Searching for a portfolio for $400 ERROR: 2013-09-02 19:11 - Failed trying to invest: global name 'LendingClubError' is not defined ^CINFO: 2013-09-02 19:11 - Stopping investor... movie@muvi:~$ cat etc/investing.json { "min_cash": 125, "min_percent": 15, "max_percent": 30, "max_per_note": 125, "portfolio": "Autoinvested", "filters": { "exclude_existing": true, "funding_progress": 90, "term60month": true, "term36month": true, "grades": { "All": false, "A": true, "B": false, "C": false, "D": false, "E": false, "F": false, "G": false } } }

Thanks, Sergey

jgillick commented 10 years ago

Hi Sergey,

Thanks for reporting this error with such thorough information. I just fixed the bug in the latest version (2.1.2) of the tool. Upgrade yours and let me know if it works for you now:

pip install lcinvestor==2.1.2

Thanks!

snikolaev commented 10 years ago

Hi Jeremy,

Thanks for quick response. Regretfully,I am still getting errors. See the output below.

movie@muvi:~$ lcinvestor --version lcinvestor 2.1.2 movie@muvi:~$ lcinvestor --email=email@gmail.com --pass=pass

///--------------------------- $$$ ---------------------------\ | Welcome to the unofficial Lending Club investment tool |


Authenticated successfully!

You have $134.09 in your account, free to invest

Now let's define what you want to do

========= Summary ========= Invest ALL available funds...

With at LEAST $125 available to invest Select a portfolio with an average interest rate between 15.0% - 30.0% Invest as much as $125 per loan note Add investments to: "Autoinvested"

Using saved filter "3.700i3dti25rb80a" (id:6371461)

Would you like to use these settings? [Y/n]: y

That's all we need. Now, as long as this is running, your account will be checked every 60 minutes and invested if enough funds are available.

INFO: 2013-09-04 21:29 - Authenticated INFO: 2013-09-04 21:29 - Checking for funds to invest... INFO: 2013-09-04 21:29 - $ $ $ $ $ $ $ $ $ $ INFO: 2013-09-04 21:29 - Searching for a portfolio for $125 ERROR: 2013-09-04 21:29 - Failed trying to invest: build_portfolio() got an unexpected keyword argument 'do_not_clear_staging' ^CINFO: 2013-09-04 21:29 - Stopping investor... movie@muvi:~$ lcinvestor --config=etc/investing.json --email=email@gmail.com --pass=pass

///--------------------------- $$$ ---------------------------\ | Welcome to the unofficial Lending Club investment tool |


Authenticated successfully!

You have $134.09 in your account, free to invest

Now let's define what you want to do

========= Summary ========= Invest ALL available funds...

With at LEAST $125 available to invest Select a portfolio with an average interest rate between 15% - 30% Invest as much as $125 per loan note Add investments to: "Autoinvested" Traceback (most recent call last): File "/usr/local/bin/lcinvestor", line 198, in investor.setup() File "/usr/local/lib/python2.7/dist-packages/lcinvestor/init.py", line 115, in setup self.settings.show_summary() File "/usr/local/lib/python2.7/dist-packages/lcinvestor/settings/init.py", line 321, in show_summary if self.investing['filter_id'] and type(self['filters']) is not SavedFilter: File "/usr/local/lib/python2.7/dist-packages/lcinvestor/settings/init.py", line 106, in getitem self.investing['filters'] = SavedFilter(self.investor.lc, self.investing['filter_id']) File "/usr/local/lib/python2.7/dist-packages/lendingclub/filters.py", line 460, in init self.load() File "/usr/local/lib/python2.7/dist-packages/lendingclub/filters.py", line 552, in load raise SavedFilterError('Could not parse filter from the JSON response: {0}'.format(str(e))) lendingclub.filters.SavedFilterError: "Could not parse filter from the JSON response: Expecting a list, instead received a <type 'dict'>" movie@muvi:~$ movie@muvi:~$ cat etc/investing.json { "min_cash": 125, "min_percent": 15, "max_percent": 30, "max_per_note": 125, "portfolio": "Autoinvested", "filter_id": 5, "filters": { "exclude_existing": true, "funding_progress": 90, "term60month": true, "term36month": true, "grades": { "All": false, "A": true, "B": false, "C": false, "D": false, "E": false, "F": false, "G": false } } }

Please, help.

Regards, Sergey

jgillick commented 10 years ago

Ah, it seems like pip did not update the lendingclub API module correctly when it updated lcinvestor. Try running the following terminal command:

pip list | grep lendingclub

I suspect it will list a version of lendingclub lower than 0.1.3. If not, it still might be caching an older version (I ran into this a couple days ago). The best solution would be to uninstall and reinstall that module:

sudo pip uninstall lendingclub
sudo pip install lendingclub==0.1.3

Let me know if that helps.

snikolaev commented 10 years ago

error with license file

sudo pip install lendingclub==0.1.3 Downloading/unpacking lendingclub==0.1.3 Cannot fetch index base URL http://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement lendingclub==0.1.3 No distributions at all found for lendingclub==0.1.3 Storing complete log in /home/movie/.pip/pip.log movie@muvi:~$ sudo pip install lendingclub==0.1.3 Downloading/unpacking lendingclub==0.1.3 Downloading lendingclub-0.1.3.tar.gz (41Kb): 41Kb downloaded Running setup.py egg_info for package lendingclub Traceback (most recent call last): File "", line 14, in File "/home/movie/build/lendingclub/setup.py", line 14, in license=open('LICENSE.txt').read(), IOError: [Errno 2] No such file or directory: 'LICENSE.txt' Complete output from command python setup.py egg_info: Traceback (most recent call last):

File "", line 14, in

File "/home/movie/build/lendingclub/setup.py", line 14, in

license=open('LICENSE.txt').read(),

IOError: [Errno 2] No such file or directory: 'LICENSE.txt'


Command python setup.py egg_info failed with error code 1 Storing complete log in /home/movie/.pip/pip.log

snikolaev commented 10 years ago

I installed by copying/renaming licese.txt file and running "sudo python ./setup.py install".

Now, I am getting this:

$ lcinvestor --config=etc/investing.json --email=email@gmail.com --pass=pass

///--------------------------- $$$ ---------------------------\ | Welcome to the unofficial Lending Club investment tool |


Authenticated successfully!

You have $182.28 in your account, free to invest

Now let's define what you want to do

========= Summary ========= Invest ALL available funds...

With at LEAST $125 available to invest Select a portfolio with an average interest rate between 15% - 30% Invest as much as $125 per loan note Add investments to: "Autoinvested" Traceback (most recent call last): File "/usr/local/bin/lcinvestor", line 198, in investor.setup() File "/usr/local/lib/python2.7/dist-packages/lcinvestor/init.py", line 115, in setup self.settings.show_summary() File "/usr/local/lib/python2.7/dist-packages/lcinvestor/settings/init.py", line 321, in show_summary if self.investing['filter_id'] and type(self['filters']) is not SavedFilter: File "/usr/local/lib/python2.7/dist-packages/lcinvestor/settings/init.py", line 106, in getitem self.investing['filters'] = SavedFilter(self.investor.lc, self.investing['filter_id']) File "/usr/local/lib/python2.7/dist-packages/lendingclub/filters.py", line 460, in init self.load() File "/usr/local/lib/python2.7/dist-packages/lendingclub/filters.py", line 552, in load raise SavedFilterError('Could not parse filter from the JSON response: {0}'.format(str(e))) lendingclub.filters.SavedFilterError: "Could not parse filter from the JSON response: Expecting a list, instead received a <type 'dict'>" movie@muvi:~$ cat etc/investing.json { "min_cash": 125, "min_percent": 15, "max_percent": 30, "max_per_note": 125, "portfolio": "Autoinvested", "filter_id": 5, "filters": { "exclude_existing": true, "funding_progress": 90, "term60month": true, "term36month": true, "grades": { "All": false, "A": true, "B": false, "C": false, "D": false, "E": false, "F": false, "G": false } } }

ghost commented 10 years ago

Looks like the problem is with the filter_id value in investing.json. Is the ID of your saved search filter really 5? I don't believe that's a valid ID. This shows that I should add better handling for filters that cannot be found.

snikolaev commented 10 years ago

Hi Jeremy,

What is a valid filter id? When I run lcinvestor interactively, '5' is a valid choice that I am offered. I have 6 or 7 filters saved at LC.

Thanks, Sergey

snikolaev commented 10 years ago

I figured out about the filter id. I did not realize that is the 7-digit number printed by lcinvestor. It is working now.

Thanks a lot for your help.

Regards, Sergey

jgillick commented 10 years ago

I'm glad it working for you now. It seems that I could explain the filter ID better in the docs. Can you recommend a better way to explain this?

Thanks, Jeremy

snikolaev commented 10 years ago

Hi Jeremy,

You should probably mention in the docs and the sample json configuration file that the filter id is a 7-digit number that is output'ed when lcinvestor is run in the interactive mode. Otherwise, the first thing I tried was the actual filter name as it is called in LC. After running lcinvestor interactively, I realized that the filter id could be a single digit number of the choice number. Anyway, I am happy that it is working now.

Thanks, Sergey

Date: Fri, 6 Sep 2013 11:14:45 -0700 From: notifications@github.com To: LendingClubAutoInvestor@noreply.github.com CC: sergey_nikolaev@hotmail.com Subject: Re: [LendingClubAutoInvestor] Failed trying to invest: global name 'LendingClubError' is not defined (#12)

I'm glad it working for you now. It seems that I could explain the filter ID better in the docs. Can you recommend a better way to explain this?

Thanks,

Jeremy

— Reply to this email directly or view it on GitHub.