Author denis-osipov
Recipients denis-osipov
Date 2017-09-26.04:58:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506401881.51.0.156968615835.issue31583@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-09-26 04:58:01denis-osipovsetrecipients: + denis-osipov
2017-09-26 04:58:01denis-osipovsetmessageid: <1506401881.51.0.156968615835.issue31583@psf.upfronthosting.co.za>
2017-09-26 04:58:01denis-osipovlinkissue31583 messages
2017-09-26 04:58:00denis-osipovcreate