windows - Free up serial port after SerialException 'Access is Denied' to reconnect -


i have simple class connect creates serial connection upon instantiation.

import serial import serial.tools.list_ports_windows list_ports  class connect:     def __init__(self):         connect(self)      def connect(self):         self.ser = serial.serial(port='com1')      def disconnect(self):         self.ser.close()      def __del__(self):         self.disconnect()         del self.ser 

if create instance of class , destroy instance in such way neither disconnect() nor del() method runs, port still tied up. if try connect again following exception:

serialexception: not open port 'com1': windowserror(5, 'access denied.') 

what can code disconnect serial port, can reconnect new instance of connect?


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -