Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99112

VS Code: "Import Error: No module named request" although it's installed

$
0
0

To build a web scraping program in python 3 I do the following

import urllib.request

I use a venv, which is selcted and shown on the bottom left in VS Code. The settings.json file has:

"python.pythonPath": "venv/bin/python"

Also the integrated terminal has been closed and reopened multiple times. Entering pip list shows request as installed for that venv.

If I run the file no problems come up but in output it keeps saying

Traceback (most recent call last):
File "/Users/filepath/filename.py", line 2, in 
<module>
import urllib.request
ImportError: No module named request

Important: The last time I had this file open, everything was fine with importing that module. Now after saving and reopening that project next day I keep getting this error message over and over again.

I really hope someone can help! Thanks!


Viewing all articles
Browse latest Browse all 99112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>