Requests: AttributeError: 'module' object has no attribute 'python_implementation'

Created on 10 Dec 2014  路  2Comments  路  Source: psf/requests

Python 2.7.3 (default, Feb 27 2014, 19:58:35) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> req = requests.request('GET', 'http://httpbin.org/get')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/symbol/python2.7.3/local/lib/python2.7/site-packages/requests/api.py", line 48, in request
    session = sessions.Session()
  File "/home/symbol/python2.7.3/local/lib/python2.7/site-packages/requests/sessions.py", line 284, in __init__
    self.headers = default_headers()
  File "/home/symbol/python2.7.3/local/lib/python2.7/site-packages/requests/utils.py", line 552, in default_headers
    'User-Agent': default_user_agent(),
  File "/home/symbol/python2.7.3/local/lib/python2.7/site-packages/requests/utils.py", line 521, in default_user_agent
    _implementation = platform.python_implementation()
AttributeError: 'module' object has no attribute 'python_implementation'
Needs Info

Most helpful comment

Thanks sigmavirus24 , i had a python package called platform in the same folder , so it was picking-up automatically.

All 2 comments

@reddypdl can you do python -c 'import platform; print(platform.python_implementation())', if not can you tell us how you built this version of Python? The platform module is a standard library module and platform.python_implementation() has been around since Python 2.3 so if this is a real version of Python 2.7, then that function should be present. Also is it possible you have a platform.py file in the same directory? If so, please rename it.

Thanks sigmavirus24 , i had a python package called platform in the same folder , so it was picking-up automatically.

Was this page helpful?
0 / 5 - 0 ratings