src/eric7/MicroPython/MicroPythonCommandsInterface.py

branch
eric7
changeset 9748
df9520c864f2
parent 9747
b7976868d5b0
child 9749
5d409223cf3f
diff -r b7976868d5b0 -r df9520c864f2 src/eric7/MicroPython/MicroPythonCommandsInterface.py
--- a/src/eric7/MicroPython/MicroPythonCommandsInterface.py	Tue Feb 07 18:07:12 2023 +0100
+++ b/src/eric7/MicroPython/MicroPythonCommandsInterface.py	Wed Feb 08 11:54:36 2023 +0100
@@ -1065,3 +1065,21 @@
                 return "<unsupported> <unsupported>"
             raise OSError(self.__shortError(err))
         return out.decode("utf-8").strip()
+
+    def getModules(self):
+        """
+        Public method to show a list of modules built into the firmware.
+
+        @return list of builtin modules
+        @rtype list of str
+        @exception OSError raised to indicate an issue with the device
+        """
+        commands = ["help('modules')"]
+        out, err = self.execute(commands)
+        if err:
+            raise OSError(self.__shortError(err))
+
+        modules = []
+        for line in out.decode("utf-8").splitlines()[:-1]:
+            modules.extend(line.split())
+        return modules

eric ide

mercurial