Python Problems

D

dr_springfield

Guest
I'm very new to python... ran into this error

code:

import urllib
proxies = proxies={'http': 'http://61.131.59.66:8080'}
filehandle = urllib.urlopen('http://whatismyip.com', proxies=proxies)

error:

AttributeError: 'NoneType' object has no attribute 'read'

The problem is in the proxies variable... running without it (proxies=None) generates no error. Anyone know python?
p.s. I took this code straight off the python website describing the urllib module... so it *should* work...
 
OP
D

dr_springfield

Guest
I've only used it for a few days now, and I already feel pretty comfortable in it. It's very easy to use. It used to be if I had something to do that I couldn't do by hand (like say... decrypting an encypted message, or processing a file) I would write up a little terminal C++ program to do it for me, but now that I've used python that seems ridiculous. Python is not only a thousand times easier to do anything I could ever do in C++ (aside from real development), but it also makes stuff that would have been very difficult... such as http operations...very easy. I'd recommend it, you can pick it up in a few days.

Oh, and make sure you update first.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top