By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,715 Members | 768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,715 IT Pros & Developers. It's quick & easy.

Problem with: urllib2.build_opener(urllib2.HTTPCookieProcessor(c j))

P: n/a

I get an error, when I am trying to download URL with using Cookies.
Where is the Problem?

Thank u very much for all ideas!!!


import os, cookielib, urllib2
cj = cookielib.MozillaCookieJar()
os.environ["http_proxy"] = ""
os.environ['HOME']= r"C:\tmp\COOKIE"
cj.load(os.path.join(os.environ["HOME"], "cookies.txt"))
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(c j))
r ="")

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\Programme\Python24\lib\", line 358, in open
response = self._open(req, data)
File "C:\Programme\Python24\lib\", line 376, in _open
'_open', req)
File "C:\Programme\Python24\lib\", line 337, in _call_chain
result = func(*args)
File "C:\Programme\Python24\lib\", line 1021, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Programme\Python24\lib\", line 996, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (10061, 'Connection refused')>
Sep 5 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.