deepdiff icon indicating copy to clipboard operation
deepdiff copied to clipboard

Unsupported Operation: readline + Debug Feature

Open SoundsSerious opened this issue 2 years ago • 4 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!

SoundsSerious avatar Jul 29 '23 21:07 SoundsSerious

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.

seperman avatar Aug 31 '23 21:08 seperman

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!

seperman avatar Nov 14 '23 07:11 seperman