--- a/src/eric7/MicroPython/Devices/DeviceBase.py Tue Feb 14 18:10:30 2023 +0100 +++ b/src/eric7/MicroPython/Devices/DeviceBase.py Wed Feb 15 15:55:37 2023 +0100 @@ -25,6 +25,39 @@ class BaseDevice(QObject): """ Base class for the more specific MicroPython devices. + + It includes a list of commands for general use on the various boards. + If a board needs special treatment, the command should be overwritten + in the board specific subclass. Commands are provided to perform operations + on the file system of a connected MicroPython device, for getting and setting + the time on the board and getting board related data. Supported file system + commands are: + <ul> + <li>ls: directory listing</li> + <li>lls: directory listing with meta data</li> + <li>cd: change directory</li> + <li>pwd: get the current directory</li> + <li>put: copy a file to the connected device</li> + <li>putData: write data to a file of the connected device</li> + <li>get: get a file from the connected device</li> + <li>getData: read data of a file of the connected device</li> + <li>rm: remove a file from the connected device</li> + <li>rmrf: remove a file/directory recursively (like 'rm -rf' in bash) + <li>mkdir: create a new directory</li> + <li>rmdir: remove an empty directory</li> + <li>fileSystemInfo: get information about the file system + </ul> + + Supported non file system commands are: + <ul> + <li>getBoardData: get information about the connected board</li> + <li>getDeviceData: get version info about MicroPython and some implementation + information</li> + <li>getModules: get a list of built-in modules</li> + <li>getTime: get the current time</li> + <li>syncTime: synchronize the time of the connected device</li> + <li>showTime: show the current time of the connected device</li> + </ul> """ def __init__(self, microPythonWidget, deviceType, parent=None): @@ -618,7 +651,14 @@ if dirname: command = """ import os as __os_ -__os_.rmdir('{0}') + +try: + __os_.rmdir('{0}') +except OSError as exc: + if exc.args[0] == 13: + raise OSError(13, 'Access denied or directory not empty.') + else: + raise del __os_ """.format( dirname