Python codes runs using idle but fails on command line?
<p>I am learning Python, and I have written a script per an example in the book I am reading where it imports the urllib library. This works fine when I run it from IDLE, but if I go to the folder where the file is and run "python test.py" I get an error where it tells me that</p>

<pre><code>Traceback (most recent call last):
  File "test.py", line 1, in ?
    import urllib.request
ImportError: No module named request
</code></pre>

<p>I verified that I am using Python 3.1.2. Any suggestions or ideas why this fails on the command line?</p>

<p>My code:</p>

<pre><code>import urllib.request
import time

price = 99.99
while price &gt; 1.01:
    time.sleep(3)
    page = urllib.request.urlopen("http://www.beans-r-us.biz/prices.html")
    text = page.read().decode("utf8")
    where = text.find('&gt;$')
    start_of_price = where + 2
    end_of_price = start_of_price + 4
    price = float(text[start_of_price:end_of_price])

print ("Buy!")
</code></pre>
