eric6/MicroPython/MicroPythonCommandsInterface.py

branch
micropython
changeset 7136
bddcb634a9b8
parent 7126
376deb7fefe7
child 7137
4ed2573947ff
equal deleted inserted replaced
7135:44fcfc99b864 7136:bddcb634a9b8
430 out, err = self.execute(commands) 430 out, err = self.execute(commands)
431 if err: 431 if err:
432 raise IOError(self.__shortError(err)) 432 raise IOError(self.__shortError(err))
433 return out.decode("utf-8").strip() 433 return out.decode("utf-8").strip()
434 434
435 # TODO: test this
436 def rm(self, filename): 435 def rm(self, filename):
437 """ 436 """
438 Public method to remove a file from the connected device. 437 Public method to remove a file from the connected device.
439 438
440 @param filename name of the file to be removed 439 @param filename name of the file to be removed
450 ] 449 ]
451 out, err = self.execute(commands) 450 out, err = self.execute(commands)
452 if err: 451 if err:
453 raise IOError(self.__shortError(err)) 452 raise IOError(self.__shortError(err))
454 453
455 # TODO: test this
456 def rmrf(self, name, recursive=False, force=False): 454 def rmrf(self, name, recursive=False, force=False):
457 """ 455 """
458 Public method to remove a file or directory recursively. 456 Public method to remove a file or directory recursively.
459 457
460 @param name of the file or directory to remove 458 @param name of the file or directory to remove
500 out, err = self.execute(commands) 498 out, err = self.execute(commands)
501 if err: 499 if err:
502 raise IOError(self.__shortError(err)) 500 raise IOError(self.__shortError(err))
503 return ast.literal_eval(out.decode("utf-8")) 501 return ast.literal_eval(out.decode("utf-8"))
504 502
505 # TODO: test this
506 def mkdir(self, dirname): 503 def mkdir(self, dirname):
507 """ 504 """
508 Public method to create a new directory. 505 Public method to create a new directory.
509 506
510 @param dirname name of the directory to create 507 @param dirname name of the directory to create
520 ] 517 ]
521 out, err = self.execute(commands) 518 out, err = self.execute(commands)
522 if err: 519 if err:
523 raise IOError(self.__shortError(err)) 520 raise IOError(self.__shortError(err))
524 521
525 # TODO: test this
526 def rmdir(self, dirname): 522 def rmdir(self, dirname):
527 """ 523 """
528 Public method to remove a directory. 524 Public method to remove a directory.
529 525
530 @param dirname name of the directory to be removed 526 @param dirname name of the directory to be removed
540 ] 536 ]
541 out, err = self.execute(commands) 537 out, err = self.execute(commands)
542 if err: 538 if err:
543 raise IOError(self.__shortError(err)) 539 raise IOError(self.__shortError(err))
544 540
545 # TODO: test this
546 def put(self, hostFileName, deviceFileName=None): 541 def put(self, hostFileName, deviceFileName=None):
547 """ 542 """
548 Public method to copy a local file to the connected device. 543 Public method to copy a local file to the connected device.
549 544
550 @param hostFileName name of the file to be copied 545 @param hostFileName name of the file to be copied
583 out, err = self.execute(commands) 578 out, err = self.execute(commands)
584 if err: 579 if err:
585 raise IOError(self.__shortError(err)) 580 raise IOError(self.__shortError(err))
586 return True 581 return True
587 582
588 # TODO: test this
589 def get(self, deviceFileName, hostFileName=None): 583 def get(self, deviceFileName, hostFileName=None):
590 """ 584 """
591 Public method to copy a file from the connected device. 585 Public method to copy a file from the connected device.
592 586
593 @param deviceFileName name of the file to copy 587 @param deviceFileName name of the file to copy

eric ide

mercurial