[issue46916] There is a problem with escape characters in the path passed in by pathlib.Path.mkdir()
Vincent FUNG added the comment: Thank you very much for your patient answer, I am still a developer who has just started, and it seems that I need to learn more about it. I used repr().replace to replace with forward slashes, and also restricted paths ending in a slash to Improve reliability. Thanks anagin. ;) -- ___ Python tracker <https://bugs.python.org/issue46916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46916] There is a problem with escape characters in the path passed in by pathlib.Path.mkdir()
Vincent FUNG added the comment: Oh. Got it. I thought pathlib would solve this problem completely now, without having to replace the slashes. Thank you for your patient answer. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46916] There is a problem with escape characters in the path passed in by pathlib.Path.mkdir()
Vincent FUNG added the comment: This problem occurs when the directory starts with 't', but works with os.makedirs(e) or macOS. >>> e = Path(r'F:\ceven\test2') >>> e.mkdir() Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python310\lib\pathlib.py", line 1173, in mkdir self._accessor.mkdir(self, mode) FileNotFoundError: [WinError 3] The system cannot find the path specified: 'F:\\ceven\\test2' >>> os.makedirs(e) Another question about \t: If a directory is passed as a parameter it will not be possible to use the parameter as a raw string. os.makedirs gives the same error whether it's r'%s' or repr(). -- ___ Python tracker <https://bugs.python.org/issue46916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46916] There is a problem with escape characters in the path passed in by pathlib.Path.mkdir()
New submission from Vincent FUNG : This problem occurs when the directory starts with 't', but works with os.makedirs(e) or macOS. >>> e = Path(r'F:\ceven\test2') >>> e.mkdir() Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python310\lib\pathlib.py", line 1173, in mkdir self._accessor.mkdir(self, mode) FileNotFoundError: [WinError 3] The system cannot find the path specified: 'F:\\ceven\\test2' >>> os.makedirs(e) -- components: Windows messages: 414483 nosy: paul.moore, steve.dower, tim.golden, vincent.fung, zach.ware priority: normal severity: normal status: open title: There is a problem with escape characters in the path passed in by pathlib.Path.mkdir() type: behavior versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue46916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com