Using pydsfapi on windows



  • Hi Experts,

    I am new to Duet. Please forgive me if this question has been answered somewhere...

    I am trying to use/modify the python API (pydsfapi) to communicate to my printer (Duet2 WiFi/Ethernet). Since the system has been connected to a PC which running
    DuetWebControl, I would like to use the same computer to control the printer instead of using a pi to do it. Because I am working on integrating another sensor to the system, this is the reason I would like to write my own code to control it.

    My problems are listed below :

    1. When I connected to the system, instead of using socket.AF_UNIX, I used socket.AF_INET. However, I got the error message for decoding the receiving. (Error message shows below)
      ....
      File "C:\Users\JB3D - F30-B1\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "C:\Users\JB3D - F30-B1\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
      raise JSONDecodeError("Expecting value", s, err.value) from None
      json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    2. Based on the code, it seems the return/receiving message is in JSON format. Is there any more information about this?

    Thank you very much!

    Kevin



  • @kaoshihchuan the following two links will help you understanding the new object model of RepRapFirmware version 3 (RRF3):
    https://duet3d.dozuki.com/Wiki/Object_Model_of_RepRapFirmware
    https://duet3d.github.io/DuetSoftwareFramework/api/DuetAPI.Machine.MachineModel.html#properties

    In the first link is explained, how the Duet can be accessed and explaining of the json structure.
    You should use the current RRF version (today: 3.1.1).


Log in to reply