ziirish / OctoPrint-TuyaSmartplug

Tuya Smartplug plugin for OctoPrint
Other
19 stars 15 forks source link

Replace Pycrypto with Pycryptodome #52

Closed xenoguy closed 1 year ago

xenoguy commented 1 year ago

hey, I couldn't get this working on my octoprint at all until I figured out how to print out the exception it was throwing.

pycryptodome is basically a drop in replacement for pycrypto, so no other changes necessary.

in setup.py line 38: 'pycrypto==2.6.1' change this to 'pycryptodome==3.17'

Also, on line 316 of octoprint_tuyasmartplug/init.py change this:

        except:
            self._tuyasmartplug_logger.debug(
                "Something went wrong while running the command"
            )

to this:

        except Exception as e:
            self._tuyasmartplug_logger.debug(
                "Something went wrong while running the command " + str(e)
            )

this way it spits out something useful into the debug log instead of a generic message. in my case it was: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

andrelucca commented 1 year ago

Hello @xenoguy , thanks for your suggestion, just added it in the new release, hope it helps other users troubleshoot problems as well