src/eric7/MicroPython/Devices/DeviceBase.py

branch
eric7
changeset 10515
6e790462348a
parent 10439
21c28b0f9e41
child 10683
779cda568acb
equal deleted inserted replaced
10514:5e6362665247 10515:6e790462348a
820 ) 820 )
821 out, err = self.executeCommands(command, mode=self._submitMode) 821 out, err = self.executeCommands(command, mode=self._submitMode)
822 if err: 822 if err:
823 raise OSError(self._shortError(err)) 823 raise OSError(self._shortError(err))
824 824
825 def rename(self, oldname, newname):
826 """
827 Public method to rename a file on the device.
828
829 @param oldname current name of the file
830 @type str
831 @param newname new name for the file
832 @type str
833 @exception OSError raised to indicate an issue with the device
834 """
835 if oldname and newname:
836 command = """
837 import os as __os_
838 __os_.rename('{0}', '{1}')
839 del __os_
840 """.format(
841 oldname, newname
842 )
843 out, err = self.executeCommands(command, mode=self._submitMode)
844 if err:
845 raise OSError(self._shortError(err))
846
825 def put(self, hostFileName, deviceFileName=None): 847 def put(self, hostFileName, deviceFileName=None):
826 """ 848 """
827 Public method to copy a local file to the connected device. 849 Public method to copy a local file to the connected device.
828 850
829 @param hostFileName name of the file to be copied 851 @param hostFileName name of the file to be copied

eric ide

mercurial