eric6/MicroPython/MicroPythonCommandsInterface.py

changeset 7836
2f0d208b8137
parent 7780
41420f82c0ac
child 7923
91e843545d9a
--- a/eric6/MicroPython/MicroPythonCommandsInterface.py	Sat Nov 21 19:31:16 2020 +0100
+++ b/eric6/MicroPython/MicroPythonCommandsInterface.py	Sun Nov 22 16:04:59 2020 +0100
@@ -289,7 +289,7 @@
         @type str
         @return tuple containg the directory listing
         @rtype tuple of str
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if self.__repl.isMicrobit():
             # BBC micro:bit does not support directories
@@ -306,7 +306,7 @@
             ]
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
         return ast.literal_eval(out.decode("utf-8"))
     
     def lls(self, dirname="", fullstat=False, showHidden=False):
@@ -325,7 +325,7 @@
             false) or the complete stat() tuple. 'None' is returned in case the
             directory doesn't exist.
         @rtype tuple of (str, tuple)
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if self.__repl.isMicrobit():
             # BBC micro:bit does not support directories
@@ -383,7 +383,7 @@
             ]
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
         fileslist = ast.literal_eval(out.decode("utf-8"))
         if fileslist is None:
             return None
@@ -399,7 +399,7 @@
         
         @param dirname directory to change to
         @type str
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if dirname:
             commands = [
@@ -409,7 +409,7 @@
             ]
             out, err = self.execute(commands)
             if err:
-                raise IOError(self.__shortError(err))
+                raise OSError(self.__shortError(err))
     
     def pwd(self):
         """
@@ -417,7 +417,7 @@
         
         @return current directory
         @rtype str
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if self.__repl.isMicrobit():
             # BBC micro:bit does not support directories
@@ -430,7 +430,7 @@
         ]
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
         return out.decode("utf-8").strip()
     
     def rm(self, filename):
@@ -439,7 +439,7 @@
         
         @param filename name of the file to be removed
         @type str
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if filename:
             commands = [
@@ -449,7 +449,7 @@
             ]
             out, err = self.execute(commands)
             if err:
-                raise IOError(self.__shortError(err))
+                raise OSError(self.__shortError(err))
     
     def rmrf(self, name, recursive=False, force=False):
         """
@@ -463,7 +463,7 @@
         @type bool
         @return flag indicating success
         @rtype bool
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if name:
             commands = [
@@ -496,7 +496,7 @@
             ]
             out, err = self.execute(commands)
             if err:
-                raise IOError(self.__shortError(err))
+                raise OSError(self.__shortError(err))
             return ast.literal_eval(out.decode("utf-8"))
         
         return False
@@ -507,7 +507,7 @@
         
         @param dirname name of the directory to create
         @type str
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if dirname:
             commands = [
@@ -517,7 +517,7 @@
             ]
             out, err = self.execute(commands)
             if err:
-                raise IOError(self.__shortError(err))
+                raise OSError(self.__shortError(err))
     
     def rmdir(self, dirname):
         """
@@ -525,7 +525,7 @@
         
         @param dirname name of the directory to be removed
         @type str
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if dirname:
             commands = [
@@ -535,7 +535,7 @@
             ]
             out, err = self.execute(commands)
             if err:
-                raise IOError(self.__shortError(err))
+                raise OSError(self.__shortError(err))
     
     def put(self, hostFileName, deviceFileName=None):
         """
@@ -547,10 +547,10 @@
         @type str
         @return flag indicating success
         @rtype bool
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if not os.path.isfile(hostFileName):
-            raise IOError("No such file: {0}".format(hostFileName))
+            raise OSError("No such file: {0}".format(hostFileName))
         
         with open(hostFileName, "rb") as hostFile:
             content = hostFile.read()
@@ -576,7 +576,7 @@
         
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
         return True
     
     def get(self, deviceFileName, hostFileName=None):
@@ -589,7 +589,7 @@
         @type str
         @return flag indicating success
         @rtype bool
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         if not hostFileName:
             hostFileName = deviceFileName
@@ -622,7 +622,7 @@
         ]
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
         
         # write the received bytes to the local file
         # convert eol to "\n"
@@ -640,7 +640,7 @@
         @return tuple of tuples containing the file system name, the total
             size, the used size and the free size
         @rtype tuple of tuples of (str, int, int, int)
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         commands = [
             "import os as __os_",
@@ -663,7 +663,7 @@
         ]
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
         infolist = ast.literal_eval(out.decode("utf-8"))
         if infolist is None:
             return None
@@ -688,7 +688,7 @@
         
         @return dictionary containing the version information
         @rtype dict
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         commands = [
             "import os as __os_",
@@ -697,7 +697,7 @@
         ]
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
         
         rawOutput = out.decode("utf-8").strip()
         rawOutput = rawOutput[1:-1]
@@ -715,7 +715,7 @@
         
         @return dictionary containing the implementation information
         @rtype dict
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         commands = [
             "import sys as __sys_",
@@ -738,7 +738,7 @@
         ]
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
         return ast.literal_eval(out.decode("utf-8"))
     
     def syncTime(self):
@@ -746,7 +746,7 @@
         Public method to set the time of the connected device to the local
         computer's time.
         
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         now = time.localtime(time.time())
         commands = [
@@ -795,7 +795,7 @@
         ]
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
     
     def getTime(self):
         """
@@ -803,7 +803,7 @@
         
         @return time of the device
         @rtype str
-        @exception IOError raised to indicate an issue with the device
+        @exception OSError raised to indicate an issue with the device
         """
         commands = [
             "import time as __time_",
@@ -822,5 +822,5 @@
         ]
         out, err = self.execute(commands)
         if err:
-            raise IOError(self.__shortError(err))
+            raise OSError(self.__shortError(err))
         return out.decode("utf-8").strip()

eric ide

mercurial