-
Notifications
You must be signed in to change notification settings - Fork 22
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
IndexError: list index out of range #2
Comments
Same... Mac running Python 3.8. |
Same issue here, running windows python 3.9 |
I tried adding a if statement that prevents the "error prone if statement" from checking if 'i' is below a certain number but another list index out of range error occurs some where else. |
I think the problem is in the data.csv, the function is taken in order each value, but in the csv the values are in the wrong position. There must be missing fields in the csv or something like this, because if you change the range for I you will get something but in wrong positions and null elements. |
def get_address():
full_addr = []
addrParam = ['street', 'landmark', 'area', 'city', 'state', 'country', 'pincode']
for i in range(5,12):
addrFile = csv.reader(open(full_path('data.csv'), 'r'))
allAddrs = []
for addr in addrFile:
if addr[i] != '':
allAddrs.append(addr[i])
full_addr.append(choice(allAddrs))
full_addr = dict(zip(addrParam, full_addr))
return full_addr it seems range is set to 5~12 while csv has only 10 columns |
|
fix a lot of error in fork: https://github.com/alex-pancho/randominfo |
@alex-pancho Thanks for fixing it! Is your fork available on pip? If not, why not opening a PR here? |
I tried with |
Thought I'd give this project a try but no luck.. I'm on Mac running Python 3.9.
The text was updated successfully, but these errors were encountered: