Returns True if the path exists Example: >>> a = SSHPath('exists', ssh=ssh_conn) >>> a.exists() False >>> a.touch() >>> a.exists() True >>> a.unlink() >>> a.exists() False
(self)
| 680 | self.rename(target) |
| 681 | |
| 682 | def exists(self): |
| 683 | """Returns True if the path exists |
| 684 | |
| 685 | Example: |
| 686 | |
| 687 | >>> a = SSHPath('exists', ssh=ssh_conn) |
| 688 | >>> a.exists() |
| 689 | False |
| 690 | >>> a.touch() |
| 691 | >>> a.exists() |
| 692 | True |
| 693 | >>> a.unlink() |
| 694 | >>> a.exists() |
| 695 | False |
| 696 | """ |
| 697 | try: |
| 698 | self.stat() |
| 699 | return True |
| 700 | except IOError: |
| 701 | return False |
| 702 | |
| 703 | def is_dir(self): |
| 704 | """Returns True if the path exists and is a directory |
no test coverage detected