title: python urllib error - AttributeError: 'module' object has no attribute 'request'
body: <p>I am trying out a tutorial code which fetches the html code form a website and prints it. I'm using python 3.4.0 on ubuntu. The code:</p>
  
  <pre><code>import urllib.request
  page = urllib.request.urlopen("http://www.brainjar.com/java/host/test.html")
  text = page.read().decode("utf8")
  print(text)
  </code></pre>
  
  <p>I saw previous solutions and tried them, I also tried importing only urllib but it still doesn't work. The error message displayed is as shown:</p>
  
  <pre><code>Traceback (most recent call last):
  File "string.py", line 1, in &lt;module&gt;
  import urllib.request
  File "/usr/lib/python3.4/urllib/request.py", line 88, in &lt;module&gt;
  import http.client
  File "/usr/lib/python3.4/http/client.py", line 69, in &lt;module&gt;
  import email.parser
  File "/usr/lib/python3.4/email/parser.py", line 12, in &lt;module&gt;
  from email.feedparser import FeedParser, BytesFeedParser
  File "/usr/lib/python3.4/email/feedparser.py", line 27, in &lt;module&gt;
  from email import message
  File "/usr/lib/python3.4/email/message.py", line 15, in &lt;module&gt;
  from email import utils
  File "/usr/lib/python3.4/email/utils.py", line 40, in &lt;module&gt;
  from email.charset import Charset
  File "/usr/lib/python3.4/email/charset.py", line 15, in &lt;module&gt;
  import email.quoprimime
  File "/usr/lib/python3.4/email/quoprimime.py", line 44, in &lt;module&gt;
  from string import ascii_letters, digits, hexdigits
  File "/media/saiwal/D89602199601F930/Documents/Copy/codes/python/headfirst/string.py", line 2, in &lt;module&gt;
  page = urllib.request.urlopen("http://www.brainjar.com/java/host/test.html")
  AttributeError: 'module' object has no attribute 'request'
  Error in sys.excepthook:
  Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
  from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in &lt;module&gt;
  from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in &lt;module&gt;
  from urllib.request import urlopen
  File "/usr/lib/python3.4/urllib/request.py", line 88, in &lt;module&gt;
  import http.client
  File "/usr/lib/python3.4/http/client.py", line 69, in &lt;module&gt;
  import email.parser
  File "/usr/lib/python3.4/email/parser.py", line 12, in &lt;module&gt;
  from email.feedparser import FeedParser, BytesFeedParser
  File "/usr/lib/python3.4/email/feedparser.py", line 27, in &lt;module&gt;
  from email import message
  File "/usr/lib/python3.4/email/message.py", line 15, in &lt;module&gt;
  from email import utils
  File "/usr/lib/python3.4/email/utils.py", line 40, in &lt;module&gt;
  from email.charset import Charset
  File "/usr/lib/python3.4/email/charset.py", line 15, in &lt;module&gt;
  import email.quoprimime
  File "/usr/lib/python3.4/email/quoprimime.py", line 44, in &lt;module&gt;
  from string import ascii_letters, digits, hexdigits
  File "/media/saiwal/D89602199601F930/Documents/Copy/codes/python/headfirst/string.py", line 2, in &lt;module&gt;
  page = urllib.request.urlopen("http://www.brainjar.com/java/host/test.html")
  AttributeError: 'module' object has no attribute 'request'
  
  Original exception was:
  Traceback (most recent call last):
  File "string.py", line 1, in &lt;module&gt;
  import urllib.request
  File "/usr/lib/python3.4/urllib/request.py", line 88, in &lt;module&gt;
  import http.client
  File "/usr/lib/python3.4/http/client.py", line 69, in &lt;module&gt;
  import email.parser
  File "/usr/lib/python3.4/email/parser.py", line 12, in &lt;module&gt;
  from email.feedparser import FeedParser, BytesFeedParser
  File "/usr/lib/python3.4/email/feedparser.py", line 27, in &lt;module&gt;
  from email import message
  File "/usr/lib/python3.4/email/message.py", line 15, in &lt;module&gt;
  from email import utils
  File "/usr/lib/python3.4/email/utils.py", line 40, in &lt;module&gt;
  from email.charset import Charset
  File "/usr/lib/python3.4/email/charset.py", line 15, in &lt;module&gt;
  import email.quoprimime
  File "/usr/lib/python3.4/email/quoprimime.py", line 44, in &lt;module&gt;
  from string import ascii_letters, digits, hexdigits
  File "/media/saiwal/D89602199601F930/Documents/Copy/codes/python/headfirst/string.py", line 2, in &lt;module&gt;
  page = urllib.request.urlopen("http://www.brainjar.com/java/host/test.html")
  AttributeError: 'module' object has no attribute 'request'
  </code></pre>