Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Instance' object has no attribute 'update' #29

Open
bmjjr opened this issue Oct 22, 2018 · 1 comment
Open

AttributeError: 'Instance' object has no attribute 'update' #29

bmjjr opened this issue Oct 22, 2018 · 1 comment

Comments

@bmjjr
Copy link

bmjjr commented Oct 22, 2018

Hi, I'm trying to resolve below traceback:

Failed pickle load, oid: 1203, pickle starts: b'\x80\x03ctransistor.io.persistence.scraper_newt\nSplashCo'
Traceback (most recent call last):
  File "C:\ProgramData\Miniconda3\envs\pythonocc\lib\site-packages\newt\db\jsonpickle.py", line 509, in __call__
    state = unpickler.load()
  File "C:\ProgramData\Miniconda3\envs\pythonocc\lib\site-packages\newt\db\jsonpickle.py", line 242, in load
    getattr(self, op.name)(arg)
  File "C:\ProgramData\Miniconda3\envs\pythonocc\lib\site-packages\newt\db\jsonpickle.py", line 320, in SETITEMS
    for i in range(0, len(marked), 2)
  File "C:\ProgramData\Miniconda3\envs\pythonocc\lib\site-packages\newt\db\jsonpickle.py", line 123, in update
    self.v.update(v)
AttributeError: 'Instance' object has no attribute 'update'

Environment is Python 3.6.5 on Windows 10, at the point in time where the class is being saved to newt, at the final stage of a gevent routine.

The class object being saved is a fairly simple wrapper with class attributes containing basic data types, str(), dict(), and otherwise there is one JSON byte string which contains an html page and also a .png of the html page.

And finally, even though I get this error, I can't really find a side-effect of it, the object is still persisted to newt, and the data from the JSON byte string seems to be useable. For example, I can recreate the .png from the byte string, pulling it back out from the persisted newt.db object.

But after picking through it a few hours today and unable to resolve it, figured I'd report it here to see if it stands out. Just let me know if I can provide more info. Thank you.

@bmjjr
Copy link
Author

bmjjr commented Oct 23, 2018

To update. I used the dumps function in jsonpickle.py and it appears the problem is coming from the below OrderedDict:

od = OrderedDict([('user-agent', ('User-agent', 'python-requests/2.19.1 (MechanicalSoup/0.11.0)')), ('accept-encoding', ('Accept-Encoding', 'gzip, deflate')), ('accept', ('Accept', '*/*')), ('connection', ('Connection', 'keep-alive')), ('authorization', ('Authorization', b'Basic Yx5iOnJ1VG8lPR==')), ('content-length', ('Content-Length', '5935')), ('content-type', ('Content-Type', 'application/json'))])

A dumps(od) results in:

Traceback (most recent call last):
  File "C:\ProgramData\Miniconda3\envs\pythonocc\lib\site-packages\IPython\core\interactiveshell.py", line 2961, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-131-62ab92dc09d6>", line 1, in <module>
dumps(od)
  File "C:\ProgramData\Miniconda3\envs\pythonocc\lib\site-packages\newt\db\jsonpickle.py", line 429, in dumps
sort_keys=True, indent=indent).replace(' \n', '\n')
  File "C:\ProgramData\Miniconda3\envs\pythonocc\lib\site-packages\newt\db\jsonpickle.py", line 242, in load
getattr(self, op.name)(arg)
  File "C:\ProgramData\Miniconda3\envs\pythonocc\lib\site-packages\newt\db\jsonpickle.py", line 320, in SETITEMS
for i in range(0, len(marked), 2)
  File "C:\ProgramData\Miniconda3\envs\pythonocc\lib\site-packages\newt\db\jsonpickle.py", line 123, in update
self.v.update(v)
AttributeError: 'Instance' object has no attribute 'update'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant