atom-python-run icon indicating copy to clipboard operation
atom-python-run copied to clipboard

importError: No module named request

Open ghost opened this issue 6 years ago • 2 comments

import urllib.request response = urllib.request.urlopen('http://python.org/') html = response.read() print(html)

When i run importError: No module named request.But python3 console above codes is working. May I know how can i fix this error.

ghost avatar Aug 24 '19 03:08 ghost

Only Python3 supports import urllib.request. However in Python2 you need something different: from urllib2 import urlopen. EDIT: Oh, you need to change the command in settings which executes the file. Change python {file} to python3 {file} and the same thing below at pause.

Jochebed1337 avatar Apr 21 '20 12:04 Jochebed1337

This should work. I had the same problem.

Jochebed1337 avatar Apr 22 '20 09:04 Jochebed1337