seperman / deepdiff

DeepDiff: Deep Difference and search of any Python object/data. DeepHash: Hash of any object based on its contents. Delta: Use deltas to reconstruct objects by adding deltas together.

Home Page:http://zepworks.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unsupported Operation: readline + Debug Feature

SoundsSerious opened this issue · comments

I have a bug that I cannot resolve what is causing is it.

Somewhere deep in my object I see that I have a file reference that I cannot resolve. Ignore encoding errors doesn't work as well.

deepdiff.DeepHash(vs,ignore_encoding_errors=True)

Results in a trace:

File ~/miniconda3/envs/nept/lib/python3.10/site-packages/deepdiff/deephash.py:514, in DeepHash._hash(self, obj, parent, parents_ids)
    511     result, counts = self._prep_tuple(obj=obj, parent=parent, parents_ids=parents_ids)
    513 elif isinstance(obj, Iterable):
--> 514     result, counts = self._prep_iterable(obj=obj, parent=parent, parents_ids=parents_ids)
    516 elif obj == BoolObj.TRUE or obj == BoolObj.FALSE:
    517     result = 'bool:true' if obj is BoolObj.TRUE else 'bool:false'

File ~/miniconda3/envs/nept/lib/python3.10/site-packages/deepdiff/deephash.py:405, in DeepHash._prep_iterable(self, obj, parent, parents_ids)
    402 counts = 1
    403 result = defaultdict(int)
--> 405 for i, item in enumerate(obj):
    406     new_parent = "{}[{}]".format(parent, i)
    407     if self._skip_this(item, parent=new_parent):

UnsupportedOperation: readline

In this case I would hope that I could add a debug flag so as to get to the bottom of the object, so i could apply rules to filter it using the existing functionality.

  • OS: Ubuntu
  • Version 20 LTS
  • Python Version 3.10
  • DeepDiff Version 6.3.1

Thanks!

Hi @SoundsSerious
Cool username. Sorry it took me a while to see your report.
Without having reproducible code, it is difficult to pin point the problem. It may be a file object you have that does not have a readline method.

Hi @SoundsSerious
Please post reproducible code. Otherwise, I will close this ticket due to inactivity. I can't help you if I can't reproduce it!