Skip to content

Commit

Permalink
Allow ESPLoader() constructor to be called with unicode string on Pyt…
Browse files Browse the repository at this point in the history
…hon 2

Fixes minor regression in bf2ae51.
  • Loading branch information
projectgus committed Jan 29, 2018
1 parent da43b73 commit 8a8b32a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion esptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8a8b32a

Please sign in to comment.