Create a new directory at this given path.
(self, mode=0o777, parents=False, exist_ok=False)
| 1004 | os.close(fd) |
| 1005 | |
| 1006 | def mkdir(self, mode=0o777, parents=False, exist_ok=False): |
| 1007 | """ |
| 1008 | Create a new directory at this given path. |
| 1009 | """ |
| 1010 | try: |
| 1011 | os.mkdir(self, mode) |
| 1012 | except FileNotFoundError: |
| 1013 | if not parents or self.parent == self: |
| 1014 | raise |
| 1015 | self.parent.mkdir(parents=True, exist_ok=True) |
| 1016 | self.mkdir(mode, parents=False, exist_ok=exist_ok) |
| 1017 | except OSError: |
| 1018 | # Cannot rely on checking for EEXIST, since the operating system |
| 1019 | # could give priority to other errors like EACCES or EROFS |
| 1020 | if not exist_ok or not self.is_dir(): |
| 1021 | raise |
| 1022 | |
| 1023 | def chmod(self, mode, *, follow_symlinks=True): |
| 1024 | """ |