Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mp/conwebsock.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, ip, password):
self.fifo = deque()
self.fifo_lock = threading.Lock()

# websocket.enableTrace(logging.root.getEffectiveLevel() < logging.INFO)
websocket.enableTrace(logging.root.getEffectiveLevel() < logging.INFO)
self.ws = websocket.WebSocketApp("ws://%s:8266" % ip,
on_message=self.on_message,
on_error=self.on_error,
Expand All @@ -71,23 +71,23 @@ def run(self):
def __del__(self):
self.close()

def on_message(self, ws, message):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The websocket-client README indicates that this argument is still used, why the discrepancy?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe documentation is outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that they do, indeed, pass two arguments. Which version have you tested your code with?

def on_message(self, message):
self.fifo.extend(message)

try:
self.fifo_lock.release()
except:
pass

def on_error(self, ws, error):
def on_error(self, error):
logging.error("websocket error: %s" % error)

try:
self.fifo_lock.release()
except:
pass

def on_close(self, ws):
def on_close(self):
logging.info("websocket closed")

try:
Expand Down
2 changes: 1 addition & 1 deletion mp/mpfshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def main():
if args.logfile is not None:
logging.basicConfig(format=format, filename=args.logfile,level=args.loglevel)
else:
logging.basicConfig(format=format, level=logging.CRITICAL)
logging.basicConfig(format=format, level=args.loglevel)

logging.info('Micropython File Shell v%s started' % version.FULL)
logging.info('Running on Python %d.%d using PySerial %s' \
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pyserial ~= 2.7
colorama ~= 0.3.6
websocket_client ~= 0.35.0
websocket_client ~= 0.53.0