closeio / closeio-api

Python API Client for Close
http://developer.close.com/
MIT License
65 stars 47 forks source link

merge_leads.py value out of range error (pbar) #73

Closed sata closed 8 years ago

sata commented 8 years ago

python scripts/merge_leads.py --field email -k API_KEY

Traceback (most recent call last):
  File "scripts/merge_leads.py", line 206, in <module>
    pbar.update(pbar.currval + len(leads))
  File "/home/sam/sources/closeio-api/venv/local/lib/python2.7/site-packages/progressbar/progressbar.py", line 252, in update
    raise ValueError('Value out of range')
ValueError: Value out of range

Added a bit of logging and I could see that in the first iteration it found 1371 leads:

2016-10-17 15:30:26,676 - closeio.api.merge_leads - INFO - Total Leads: (1371), Offset: (0)

Then at some point it tries to update from 1300 with 100 and thus value out of range.

2016-10-17 15:40:29,934 - closeio.api.merge_leads - INFO - Currval: (1300), len(leads) (100)

Is this assumption correct total_leads = resp['total_results']?

wojcikstefan commented 8 years ago

Hi @sata, this should be fixed by 209d7e02ce7eaf660ee5e76748782d738ca93515. Thank you for reporting it!