question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ipinfo return an error (IndexError: tuple index out of range) when details of specific IP address is not available.

See original GitHub issue

I am getting IndexError for following code

import ipinfo
access_token = '************'
handler = ipinfo.getHandler(access_token)
ip_country = lambda x:handler.getDetails(x).country


df1['country'] = df1["IP_address"].apply(ip_country)

There are few IP address for which it gives IndexError. For Example : 192.168.73.231, 10.62.100.139 If we try handler.getDetails('10.62.100.139').country, it will retrun IndexError:tuple index out of range.

Can you edit ipinfo package that it return NAN in such cases?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
UmanShahzadcommented, Mar 18, 2019

@dc-aichara It’s released!

1reaction
UmanShahzadcommented, Mar 15, 2019

@dc-aichara Yep will merge and release it ASAP.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python IndexError: tuple index out of range Solution
The IndexError: tuple index out of range error occurs when you try to access an item in a tuple that does not exist....
Read more >
IndexError: tuple index out of range ----- Python - Stack Overflow
I'm running a simple python program that will display the data from mySQL database in a tkinter form... from Tkinter import * import...
Read more >
IndexError: tuple index out of range #167 - GitHub
This probably happens when missing data is coded '.' instead of './.' (see #20 (comment)). You can recode the dataset, e.g., using plink...
Read more >
Why is this code throwing a 'tuple index out of range' error?
I'm still not entirely sure why the node connections are listed in a way that requires this, but the solution turns out to...
Read more >
IndexError: tuple index out of range in Python | bobbyhadz
The Python "IndexError: tuple index out of range" occurs when we try to access an index that doesn't exist in a tuple. Indexes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found