For one thing, setting log to True does not do anything, as the same instance var is overwritten in the same line. Print('ERROR: serial port connection failed') class Device():ĭef _init_(self, log = True, com_port=None, imei=None, ser=None, baud_rate=115200): It works as is, but I don't like having code in place that I don't understand. The init_module() function runs several functions using ('command'). The function get_serial_port checks communication and returns an instance linked to a com port. I assume this has something to do with garbage collection in the Serial class, but I don't understand what's going on. (note that the get_serial_port function verifies communication before returning the instance). If ('at\r') isn't called in init, then r is None elsewhere in the class. I'm writing a class that uses a function, get_serial_port().
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |