Create a new directory at this given path.
(self, mode=0o777, parents=False, exist_ok=False)
| 1109 | os.close(fd) |
| 1110 | |
| 1111 | def mkdir(self, mode=0o777, parents=False, exist_ok=False): |
| 1112 | """ |
| 1113 | Create a new directory at this given path. |
| 1114 | """ |
| 1115 | try: |
| 1116 | os.mkdir(self, mode) |
| 1117 | except FileNotFoundError: |
| 1118 | if not parents or self.parent == self: |
| 1119 | raise |
| 1120 | self.parent.mkdir(parents=True, exist_ok=True) |
| 1121 | self.mkdir(mode, parents=False, exist_ok=exist_ok) |
| 1122 | except OSError: |
| 1123 | # Cannot rely on checking for EEXIST, since the operating system |
| 1124 | # could give priority to other errors like EACCES or EROFS |
| 1125 | if not exist_ok or not self.is_dir(): |
| 1126 | raise |
| 1127 | |
| 1128 | def chmod(self, mode, *, follow_symlinks=True): |
| 1129 | """ |