views:

56

answers:

1

Hi.

New to Python, but I'm trying to...retrieve data from a site:

import urllib.request
response = urllib.request.urlopen("http://www.python.org")

This is the same code I've seen from the Python 3.1 docs. And a lot of sites.

However, I get:

Message    File Name    Line    Position    
Traceback                
    <module>    G:\My Documents\Python\HTTP.py    14        
    urlopen    E:\Python 3.1\Lib\urllib\request.py    119        
    open    E:\Python 3.1\Lib\urllib\request.py    342        
    _open    E:\Python 3.1\Lib\urllib\request.py    360        
    _call_chain    E:\Python 3.1\Lib\urllib\request.py    320        
    http_open    E:\Python 3.1\Lib\urllib\request.py    1063        
    do_open    E:\Python 3.1\Lib\urllib\request.py    1048        
URLError: <urlopen error [Errno 10022] An invalid argument was supplied>     

I have no idea what's causing this. Anyone know?

+1  A: 

Maybe try turning off the firewall? Since you are on Windows, that might be the problem.

sukhbir
Hmm. For some reason that worked (turning it off, and then allowing PyScripter through the firewall). Thanks, I feel a more descriptive error than 'invalid argument' would've helped.
The Communist Duck