473,322 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

cannot pickle object returned by urllib2.urlopen()

got a exception: "a class that defines __slots__ without defining
__getstate__ cannot be pickled "
why?
and is there any other dump method but for pickle to store the kind of
object ?

Nov 12 '08 #1
2 2467
On Wed, 12 Nov 2008 11:00:26 +0800, scsoce wrote:
got a exception: "a class that defines __slots__ without defining
__getstate__ cannot be pickled "
why?
and is there any other dump method but for pickle to store the kind of
object ?
I can't answer either of your questions, but why are you trying to pickle
an open connection to a (possibly remote) URL? I can't imagine how that
could possibly work even in principle.

--
Steven
Nov 12 '08 #2
On Wed, 12 Nov 2008 11:00:26 +0800, scsoce wrote:
>
>>got a exception: "a class that defines __slots__ without defining
__getstate__ cannot be pickled "
why?
Because in the absence of any other information, the default
way of pickling an object is to save the contents of its
__dict__. But an object with __slots__ doesn't necessarily
have a __dict__, and even if it does, it doesn't include
the contents of the slots. So you need to tell pickle how to
deal with it by defining __getstate__ and __setstate__ methods.

--
Greg
Nov 13 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Pascal | last post by:
Hello, I want to acces my OWA (Outlook Web Acces - http Exchange interface) server with urllib2 but, when I try, I've always a 401 http error. Can someone help me (and us)? Thanks. ...
2
by: john | last post by:
Im new to python. So I was hoping someone could provide the following. How would I go about checking if a user can be opened. For example if user provides www.x.com, how would I check if there is...
0
by: Matt | last post by:
I'm trying to get the HTML data off of a webpage. Let's say for the sake of argument it's the python homepage. I've googled around and found some examples that people said worked. Here's what...
0
by: Ali.Sabil | last post by:
hello all, I just maybe hit a bug in both urllib and urllib2, actually urllib doesn't support proxy authentication, and if you setup the http_proxy env var to...
1
by: Alessandro Fachin | last post by:
I write this simply code that should give me the access to private page with htaccess using a proxy, i don't known because it's wrong... import urllib,urllib2 #input url...
1
by: est | last post by:
A simple py script import urllib2 req=urllib2.Request("http://www.google.com") req.set_proxy("127.0.0.1:1","http") print urllib2.urlopen(req).read()
0
by: Jinshi | last post by:
Hello, everyone, I am quite new to python and I don't know how to solve this problem. I hope someone can help me. I just did a test in python shell: Traceback (most recent call last): File...
1
by: Magnus.Moraberg | last post by:
Hi, I have the following code - import urllib2 from BeautifulSoup import BeautifulSoup proxy_support = urllib2.ProxyHandler({"http":"http:// 999.999.999.999:8080"}) opener =...
1
by: leo1980 | last post by:
i use urllib2 to open the websites and get info. it works for a while, then will be stopped, the error in idle is http error 404 no such domain. but i just changed the parameters in the url by...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.