Why is this Python code running twice?
python, python-2.7, python-requests
Solution
You gave your script a name of a standard module or something else that is imported by the `requests` package. You created a circular import.
yourscript -> import requests -> [0 or more other modules] -> import yourscript -> import requests again
Because `requests` didn't complete importing the first time you get to see these differences in the list of supported objects.
Don't do that. Rename your script to something else and it'll all work.
Problem
I have a Python script with just these 2 lines: ``` import requests print len(dir(requests)) ``` It prints: ``` 12 48 ``` When I print the actual list `dir(requests)`, I get this: ``` ['__author__', '__build__', '__builtins__', '__copyright__', '__doc__', '__file__', '__license__', '__name__', '__package__', '__path__', '__title__', '__version__'] ['ConnectionError', 'HTTPError', 'NullHandler', 'PreparedRequest', 'Request', 'RequestException', 'Response', 'Session', 'Timeout', 'TooManyRedirects', 'URLRequired', '__author__', '__build__', '__builtins__', '__copyright__', '__doc__', '__file__', '__license__', '__name__', '__package__', '__path__', '__title__', '__version__', 'adapters', 'api', 'auth', 'certs', 'codes', 'compat', 'cookies', 'delete', 'exceptions', 'get', 'head', 'hooks', 'logging', 'models', 'options', 'packages', 'patch', 'post', 'put', 'request', 'session', 'sessions', 'status_codes', 'structures', 'utils'] ``` I'm guessing there are multiple `requests` modules or something like that. Please help.