Issue
I`m trying to handle the exception 'ProfileNotExistsException' and the code is as follows:
try:
profile = instaloader.Profile.from_username(bot.context, followees[i])
#Other statements
except ProfileNotExistsException:
print('exception')
But This NameError is occurring.
NameError Traceback (most recent call last)
Input In [11], in <cell line: 2>()
6 allfolloweesDataList.append((profile.userid,profile.username,profile.full_name,profile.followers,profile.followees,profile.is_verified,profile.biography,profile.external_url))
7 print(i,end=',')
----> 8 except ProfileNotExistsException:
9 print('exception')
NameError: name 'ProfileNotExistsException' is not defined
How can I define a name for an exception like this?
Solution
Looking at the source code for the instaloader
package, I believe this is what you are looking for:
from instaloader.exceptions import ProfileNotExistsException
try:
profile = instaloader.Profile.from_username(bot.context, followees[i])
...
except ProfileNotExistsException:
print('exception')
Answered By - Jacob Lee
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.