Sep-06-2023, 03:58 PM
Hi,
i'm very very new to python, but familiar with vba, so understand how basics work and in this case a loop.
I have the following code:
...more code here to retrieve records...
Run ok, but then I get an error:
while i <= response
to
while i < response
I have made it print at each i, and it will print up to the total number of records.
Any advice and guidance would be greatly appreciated.
i'm very very new to python, but familiar with vba, so understand how basics work and in this case a loop.
I have the following code:
1 2 3 4 5 |
i = 1 num_page = 1 bar = progressbar.ProgressBar(max_value = response[ 'meta' ][ 'total' ], widgets = widgets).start() print ( "Total number of records : " , response[ 'meta' ][ 'total' ]) while i < = response[ 'meta' ][ 'total' ]: |
1 2 |
bar.update(i) i = i + 1 |
Error:Total number of records : 494
[Elapsed time: 0:06:18] |**********************************| (ETA: 00:00:00) Traceback (most recent call last):
File "C:\Users\Admin\Downloads\patients_wip.py", line 118, in <module>
bar.update(i)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\progressbar\bar.py", line 672, in update
raise ValueError(
ValueError: Value 495 is out of range, should be between 0 and 494
[Elapsed time: 0:06:19] |**********************************| (Time: 0:06:19)
I've tried changing from while i <= response
to
while i < response
I have made it print at each i, and it will print up to the total number of records.
Any advice and guidance would be greatly appreciated.