I am new to both python and Aptana.
I am trying to use the tweepy package in python. I have the following code (from python’s site):
import tweepy
user = tweepy.api.get_user('twitter') # "undefined variable" error occurs on this line
print user.screen_name
print user.followers_count
for friend in user.friends():
print friend.screen_name
I get an “Undefined variable from import: get_user”. The code actually runs fine with no errors and produces the expected results. I googled and found how to resolve the undefined variable error, but it seems like a hack-a-round. In sum, that link says to add “get_user” to globals in the preferences.
Being new to both Python and Aptana, I just wanted to check to see if that is the best way to resolve it….it just seems like a hack. When I change “tweepy.api.get_user” to “tweepy.api.public_timeline” I get the same error and thus will have to manually add “public_timeline” to the globals….It doesn’t seem like the correct way when you have to manually configure each variable.
thanks!
If you would like to not be warned about this you may exclude the warning:
goto Window -> Preferences -> PyDev -> Editor -> Code Analysis
Click on the Undefined tab and add get_user to the textbox. That will clear up your warning.
Andrew