• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

3.6.0 RC1 python errors in OM with SubscribeConnection

Scheduled Pinned Locked Moved
Beta Firmware
3
3
64
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    achrn
    last edited by 16 Mar 2025, 20:47

    I have Duet 3 MB6HC with Duet 3 Expansion TOOL1LC running 3.6.0-rc.1, SBC mode.

    I have a plugin which is python which makes a subscribe connection then attempts to download the whole object object model (it then goes on to do other stuff, but it fails at trying to get the object model). This was running fine on 3.5.4.

    Before this point is only global variables, imports (including from dsf.connections import SubscribeConnection, SubscriptionMode), define some functions.
    verbose and vTS are both true to generate the logs comments with timestamps.

    #################################################
    # main
    #################################################
    if __name__ == '__main__':
    # establish the dsf-python connection, with some re-tries just in case
    for attempt in range(5):
    try:
    if verbose: print(("{:.6f} ".format(time.time()) if vTS else '') + 'try subscribe connection', flush=True)
    subscribe_connection = SubscribeConnection(SubscriptionMode.PATCH, debug=False)
    subscribe_connection.connect()
    except:
    time.sleep(3)
    else:
    if verbose: print(("{:.6f} ".format(time.time()) if vTS else '') + 'got subscribe connection', flush=True)
    break
    else:
    # ran to end of our attempts and didn't break out so still not established
    # make one last attempt after a longer pause
    time.sleep(15)
    subscribe_connection = SubscribeConnection(SubscriptionMode.PATCH, debug=False)
    subscribe_connection.connect()
    try:
    # get the complete object model once
    # note we cast it to a string in order to feed it in to json.loads
    om = json.loads(str(subscribe_connection.get_object_model()))

    This apparently makes the connection OK (log messages at lines 10 and 16 above appear OK at 3 and 4 below) but then generates a traceback referring to /usr/lib/python3/dist-packages/dsf/object_model/spindles/spindles.py:

    Mar 16 20:19:19 delta DuetPluginService[838]: [info] Plugin PyDaemon: Launching /opt/dsf/plugins/PyDaemon/dsf/pydaemon.py
    Mar 16 20:19:19 delta DuetPluginService[838]: [info] Plugin PyDaemon: Process has been started (pid 2181)
    Mar 16 20:19:19 delta DuetPluginService[2181]: 1742156359.805182 try subscribe connection
    Mar 16 20:19:19 delta DuetPluginService[2181]: 1742156359.806868 got subscribe connection
    Mar 16 20:19:19 delta DuetPluginService[2181]: Traceback (most recent call last):
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/opt/dsf/plugins/PyDaemon/dsf/pydaemon.py", line 174, in <module>
    Mar 16 20:19:19 delta DuetPluginService[2181]: om = json.loads(str(subscribe_connection.get_object_model()))
    Mar 16 20:19:19 delta DuetPluginService[2181]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/usr/lib/python3/dist-packages/dsf/connections/subscribe_connection.py", line 43, in get_object_model
    Mar 16 20:19:19 delta DuetPluginService[2181]: object_model = self.receive(ObjectModel)
    Mar 16 20:19:19 delta DuetPluginService[2181]: ^^^^^^^^^^^^^^^^^^^^^^^^^
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/usr/lib/python3/dist-packages/dsf/connections/base_connection.py", line 78, in receive
    Mar 16 20:19:19 delta DuetPluginService[2181]: return cls.from_json(json.loads(json_string))
    Mar 16 20:19:19 delta DuetPluginService[2181]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/usr/lib/python3/dist-packages/dsf/object_model/model_object.py", line 87, in from_json
    Mar 16 20:19:19 delta DuetPluginService[2181]: return cls()._update_from_json(**preserve_builtin(data))
    Mar 16 20:19:19 delta DuetPluginService[2181]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/usr/lib/python3/dist-packages/dsf/object_model/object_model.py", line 160, in _update_from_json
    Mar 16 20:19:19 delta DuetPluginService[2181]: super(ObjectModel, self)._update_from_json(**kwargs)
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/usr/lib/python3/dist-packages/dsf/object_model/model_object.py", line 76, in _update_from_json
    Mar 16 20:19:19 delta DuetPluginService[2181]: setattr(self, attr_name, attr.update_from_json(json_value))
    Mar 16 20:19:19 delta DuetPluginService[2181]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/usr/lib/python3/dist-packages/dsf/object_model/model_collection.py", line 55, in update_from_json
    Mar 16 20:19:19 delta DuetPluginService[2181]: self.append(self._item_constructor().update_from_json(item_to_add))
    Mar 16 20:19:19 delta DuetPluginService[2181]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/usr/lib/python3/dist-packages/dsf/object_model/model_object.py", line 93, in update_from_json
    Mar 16 20:19:19 delta DuetPluginService[2181]: return self._update_from_json(**preserve_builtin(data))
    Mar 16 20:19:19 delta DuetPluginService[2181]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/usr/lib/python3/dist-packages/dsf/object_model/model_object.py", line 69, in _update_from_json
    Mar 16 20:19:19 delta DuetPluginService[2181]: setattr(self, json_key_snake, json_value)
    Mar 16 20:19:19 delta DuetPluginService[2181]: File "/usr/lib/python3/dist-packages/dsf/object_model/spindles/spindles.py", line 38, in active
    Mar 16 20:19:19 delta DuetPluginService[2181]: self._active = int(value)
    Mar 16 20:19:19 delta DuetPluginService[2181]: ^^^^^^^^^^
    Mar 16 20:19:19 delta DuetPluginService[2181]: TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
    Mar 16 20:19:19 delta DuetPluginService[838]: [info] Plugin PyDaemon: Process has been stopped with exit code 1

    I haven't done much digging, but my immediate thought is that all I've done in the script so far is a subscribe_connection.connect() which has succeeded first time (not needing any retries) and then the om = json.loads(str(subscribe_connection.get_object_model())) failing doesn't seem like I've done enough for it to be a problem in my code... (om at this point is empty - om = {} among the global variable definitions).

    My full plugin python file: pydaemon.py (though that's one in which verbose and vTS are False).

    undefined 1 Reply Last reply 20 Mar 2025, 14:21 Reply Quote 0
    • undefined
      droftarts administrators @achrn
      last edited by droftarts 20 Mar 2025, 14:21

      @achrn One for @chrishamm to look at. Related: https://forum.duet3d.com/topic/37701/

      Ian

      Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

      1 Reply Last reply Reply Quote 0
      • undefined droftarts referenced this topic 20 Mar 2025, 14:23
      • undefined
        chrishamm administrators
        last edited by 20 Mar 2025, 14:29

        Closing as duplicate.

        Duet software engineer

        1 Reply Last reply Reply Quote 0
        • undefined chrishamm locked this topic 20 Mar 2025, 14:29
        3 out of 3
        • First post
          3/3
          Last post
        Unless otherwise noted, all forum content is licensed under CC-BY-SA