Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top