Repository: wendlers/mpfshell (language: python)

Issue:
Mpfshel closes when connecting to esp82 or esp32
Esptool and mpfshell were installed on linux mint.

The firmware is deleted and correctly loaded to esp82 and esp32, python 3.8 and pyserial 3.5 are used. When trying to connect to esp82 or esp32 using mpfshell, the connection is established, but the mpfshell closes. The above is repeated regardless of the ESPxx that is used. The firmware has been reinstalled and the card changed (I have tested it on 8 different cards)

Any idea what could be wrong?
![Problema](https://user-images.githubusercontent.com/42783218/106940065-b2033d00-66e6-11eb-80c2-5a54142830d4.png)




Discussion / hints:
This only happens with version 0.9.2,
if you roll back to 0.9.1 works well.
That's interesting, can someone bisect and find the offending commit?
same problem with 0.9.2 on windows -> esp32
this is my first install - how do you do a 'roll back' to 0.9.1.   I have googled it but it is not clear and I am new to python/pip...
Thank You
uninstall first
pip uninstall mpfshell
reinstall specifying version
pip install mpfshell==0.9.1
pip or pip3, whetever you are using.

Fix patch:
diff --git a/mp/conwebsock.py b/mp/conwebsock.py
index 2354c02..0805d75 100644
--- a/mp/conwebsock.py
+++ b/mp/conwebsock.py
@@ -72,7 +72,7 @@ def run(self):
     def __del__(self):
         self.close()
 
-    def on_message(self, message):
+    def on_message(self, ws, message):
         self.fifo.extend(message)
 
         try:
@@ -80,7 +80,7 @@ def on_message(self, message):
         except:
             pass
 
-    def on_error(self, error):
+    def on_error(self, ws, error):
         logging.error("websocket error: %s" % error)
 
         try:
diff --git a/mp/mpfexp.py b/mp/mpfexp.py
index be1b195..99daafa 100644
--- a/mp/mpfexp.py
+++ b/mp/mpfexp.py
@@ -463,7 +463,7 @@ def mpy_cross(self, src, dst=None):
             return_code = subprocess.call("mpy-cross -o %s %s" % (dst, src), shell=True)
 
         if return_code != 0:
-            raise IOError("Filed to compile: %s" % src)
+            raise IOError("Failed to compile: %s" % src)
 
 
 class MpFileExplorerCaching(MpFileExplorer):
diff --git a/requirements.txt b/requirements.txt
index 4e7722c..cab05d2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
 pyserial ~= 3.4
 colorama ~= 0.3.6
-websocket_client ~= 0.56.0
+websocket_client ~= 0.35.0


Test patch:
diff --git a/tests/ontarget/conftest.py b/tests/ontarget/conftest.py
index 01bf361..9066d97 100644
--- a/tests/ontarget/conftest.py
+++ b/tests/ontarget/conftest.py
@@ -73,7 +73,7 @@ def mpsetup(request):
             "pytest.py",
             """
 def rm(path):
-    import os
+    import uos as os
     files = os.listdir(path)
     for f in files:
         if f not in ['boot.py', 'port_config.py']:
@@ -88,7 +88,7 @@ def rm(path):
         )
 
         fe.exec_("import pytest")
-        fe.exec_("pytest.rm(os.getcwd())")
+        fe.exec_("pytest.rm('.')")
 
 
 @pytest.fixture(scope="function")