iHSV-Servo-Tool icon indicating copy to clipboard operation
iHSV-Servo-Tool copied to clipboard

Cannot reopen port

Open martin2250 opened this issue 7 years ago • 0 comments

Hi Robert,

closing and reopening the serial port does not work ("Device does not respond"), only restarting the program fixes the issue. removing the try catch block gives

Traceback (most recent call last):
  File "iHSV-Servo-Tool.py", line 307, in openCloseComport
    self.servo.read_register(0x80)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python36\lib\site-packages\minimalmodbus.py", line 258, in read_register
    return self._genericCommand(functioncode, registeraddress, numberOfDecimals=numberOfDecimals, signed=signed)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python36\lib\site-packages\minimalmodbus.py", line 697, in _genericCommand
    payloadFromSlave = self._performCommand(functioncode, payloadToSlave)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python36\lib\site-packages\minimalmodbus.py", line 795, in _performCommand
    response = self._communicate(request, number_of_bytes_to_read)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python36\lib\site-packages\minimalmodbus.py", line 893, in _communicate
    self.serial.write(request)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python36\lib\site-packages\serial\serialwin32.py", line 304, in write
    raise portNotOpenError
serial.serialutil.SerialException: Attempting to use a port that is not open

so it's not an actual error with the servos.

Greetings Martin

martin2250 avatar Feb 11 '18 10:02 martin2250