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

[BUG] views created by select_objects/exclude_objects fail to serialize #636

Closed
1 of 3 tasks
lethosor opened this issue Oct 26, 2020 · 0 comments · Fixed by #638
Closed
1 of 3 tasks

[BUG] views created by select_objects/exclude_objects fail to serialize #636

lethosor opened this issue Oct 26, 2020 · 0 comments · Fixed by #638
Labels
bug Bug fixes core Issues related to Core features

Comments

@lethosor
Copy link
Contributor

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
  • FiftyOne installed from (pip or source): source
  • FiftyOne version (run fiftyone --version): 0.6.3 (85c0142)
  • Python version: 3.6

Commands to reproduce

On obj-selection (currently at 85c0142), select some objects in the app, then run:

import fiftyone.utils.selection as fous
session.view = fous.select_objects(dataset, session.selected_objects)
session.view = fous.exclude_objects(dataset, session.selected_objects)

Describe the problem

Both of the above views trigger the following error:

Uncaught exception
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "fiftyone/core/client.py", line 155, in __setattr__
    super().__setattr__(name, value)
  File "fiftyone/core/session.py", line 85, in wrapper
    self._update_state()
  File "fiftyone/core/session.py", line 313, in _update_state
    self.state = self.state
  File "fiftyone/core/client.py", line 153, in __setattr__
    self._hc_client.update(value)
  File "fiftyone/core/client.py", line 101, in update
    self.emit("update", {"data": data.serialize(), "include_self": False})
  File "/lib/python3.6/site-packages/socketio/namespace.py", line 171, in emit
    callback=callback)
  File "/lib/python3.6/site-packages/socketio/client.py", line 344, in emit
    binary=binary))
  File "/lib/python3.6/site-packages/socketio/client.py", line 452, in _send_packet
    encoded_packet = pkt.encode()
  File "/lib/python3.6/site-packages/socketio/packet.py", line 71, in encode
    encoded_packet += self.json.dumps(data, separators=(',', ':'))
  File "/usr/lib/python3.6/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'ObjectId' is not JSON serializable

Other info / logs

This was likely introduced in the original implementation, #616

I was also able to reproduce on develop by obtaining a sample/field ID manually from the app, so this is not specific to obj-selection:

session.view = fous.exclude_objects(dataset, [{'sample_id': '5f96f32da6350af28e420e65', 'object_id': '5f96f32da6350af28e420ec9', 'field': 'fieldname'}])

What areas of FiftyOne does this bug affect?

  • App: FiftyOne application issue
  • Core: Core fiftyone Python library issue
  • Server: Fiftyone server issue
@lethosor lethosor added bug Bug fixes core Issues related to Core features labels Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug fixes core Issues related to Core features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant