This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author denis-osipov
Recipients denis-osipov
Date 2017-09-26.04:58:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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
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
--- (original)
+++ (refactored)

--some changes--

Traceback (most recent call last):
  File "D:/repos/cpython/Tools/scripts/2to3", line 5, in <module>
  File "D:\repos\cpython\lib\lib2to3\", line 259, in main
  File "D:\repos\cpython\lib\lib2to3\", line 687, in refactor
    items, write, doctests_only)
  File "D:\repos\cpython\lib\lib2to3\", line 282, in refactor
    self.refactor_file(dir_or_file, write, doctests_only)
  File "D:\repos\cpython\lib\lib2to3\", line 728, in refactor_file
    *args, **kwargs)
  File "D:\repos\cpython\lib\lib2to3\", line 339, in refactor_file
    write=write, encoding=encoding)
  File "D:\repos\cpython\lib\lib2to3\", line 505, in processed_file
    self.write_file(new_text, filename, old_text, encoding)
  File "D:\repos\cpython\lib\lib2to3\", line 84, in write_file
  File "D:\repos\cpython\\lib\", 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/

$ /d/repos/cpython/python.bat /d/repos/cpython/Tools/scripts/2to3 -n -W --add-suffix=3 -o .
Date User Action Args
2017-09-26 04:58:01denis-osipovsetrecipients: + denis-osipov
2017-09-26 04:58:01denis-osipovsetmessageid: <>
2017-09-26 04:58:01denis-osipovlinkissue31583 messages
2017-09-26 04:58:00denis-osipovcreate