requests module is not working - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: requests module is not working (/thread-29570.html) |
requests module is not working - varsh - Sep-10-2020 hi, I pip installed requests module and added it to my pydev path in my eclipse project. But when i run the program, I get the following error. Please help ! import requests r = requests.get( 'https://xkcd.com/' ) print( r )
RE: requests module is not working - buran - Sep-10-2020 You have a file "/Users/apple/eclipse-workspace/test_demo/test_package/logging.py" . This file shadows the logging module from Standard Library. Remove/rename that file.
RE: requests module is not working - varsh - Sep-10-2020 (Sep-10-2020, 02:36 PM)buran Wrote: You have a file OMG ! You are a saviour. It works perfectly fine now. Could you please explain as to how this code was linked to a different file ? Because i read it on the net that having a different requests.py file might be a problem.But how this file created a problem? RE: requests module is not working - buran - Sep-10-2020 https://docs.python.org/3/tutorial/modules.html#the-module-search-path python looks for modules/packages you try to import in different locations in particular order. it finds your logging.py and try to import it, but this result in error now documentation states that Quote:When a module named spam is imported, the interpreter first searches for a built-in module with that name. logging is built-in module, so I am missing something in this case. maybe someone else will shed some light why this happens.
|