diff --git a/esptool.py b/esptool.py index b36187666..c55a1501b 100755 --- a/esptool.py +++ b/esptool.py @@ -99,6 +99,12 @@ def byte(bitstr, index): def byte(bitstr, index): return bitstr[index] +# Provide a 'basestring' class on Python 3 +try: + basestring +except NameError: + basestring = str + def esp8266_function_only(func): """ Attribute for a function only supported on ESP8266 """ @@ -183,7 +189,7 @@ def __init__(self, port=DEFAULT_PORT, baud=ESP_ROM_BAUD, trace_enabled=False): with ones which throw NotImplementedInROMError(). """ - if isinstance(port, str): + if isinstance(port, basestring): self._port = serial.serial_for_url(port) else: self._port = port