New submission from Denis Osipov: 2to3 doesn't work if called for file in current directory with --add-suffix option. $ /d/repos/cpython/python.bat /d/repos/cpython/Tools/scripts/2to3 -n -W --add-suffix=3 test2to3.py Running Debug|x64 interpreter... WARNING: --write-unchanged-files/-W implies -w. RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored test2to3.py --- test2to3.py (original) +++ test2to3.py (refactored)
--some changes-- Traceback (most recent call last): File "D:/repos/cpython/Tools/scripts/2to3", line 5, in <module> sys.exit(main("lib2to3.fixes")) File "D:\repos\cpython\lib\lib2to3\main.py", line 259, in main options.processes) File "D:\repos\cpython\lib\lib2to3\refactor.py", line 687, in refactor items, write, doctests_only) File "D:\repos\cpython\lib\lib2to3\refactor.py", line 282, in refactor self.refactor_file(dir_or_file, write, doctests_only) File "D:\repos\cpython\lib\lib2to3\refactor.py", line 728, in refactor_file *args, **kwargs) File "D:\repos\cpython\lib\lib2to3\refactor.py", line 339, in refactor_file write=write, encoding=encoding) File "D:\repos\cpython\lib\lib2to3\refactor.py", line 505, in processed_file self.write_file(new_text, filename, old_text, encoding) File "D:\repos\cpython\lib\lib2to3\main.py", line 84, in write_file os.makedirs(output_dir) File "D:\repos\cpython\\lib\os.py", line 221, in makedirs mkdir(name, mode) FileNotFoundError: [WinError 3] The system cannot find the path specified: '' It works well if I use absolute path for target file or set -o: $ /d/repos/cpython/python.bat /d/repos/cpython/Tools/scripts/2to3 -n -W --add-suffix=3 /d/MyPythonScripts/test2to3.py $ /d/repos/cpython/python.bat /d/repos/cpython/Tools/scripts/2to3 -n -W --add-suffix=3 -o . test2to3.py ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 303001 nosy: denis-osipov priority: normal severity: normal status: open title: 2to3 call for file in current directory yields error type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31583> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com