After much fiddling around, I got 2to3 to work! And it did a fine, if not perfect job on mycalc.py (which has about 120 functions and 1993 lines).
What I did that worked, was to use the E:\Python26\Tools\Scripts, and not Python31. E:\Python26\Tools\Scripts has 2to3.py. I added the folder lib2to3\ and mycalc.py to E:\Python26\Tools\Scripts, and did a E:\Python26\Tools\Scripts>2to3 -w mycalc.py The -w switch first backed up mycalc.py as mycalc.py.bak, and then 2to3.py went to work. The only problems it couldn't handle are shown below. They are all of the same sort, involving a unicode error. I simply remmed out the problem causing functions, and now it seems mycalc.py is good to go with Python 3.1. I'll look into the "unicode" errors later -- much later. >>> from mycalc import * Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> from mycalc import * File "E:\Python31\lib\site-packages\mycalc.py", line 172 """ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 33-34: malformed \N character escape >>> from mycalc import * Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> from mycalc import * File "E:\Python31\lib\site-packages\mycalc.py", line 186 """ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 198-199: malformed \N character escape >>> from mycalc import * Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> from mycalc import * File "E:\Python31\lib\site-packages\mycalc.py", line 207 file = open('E:\PythonWork\Nutshell\\words.txt', 'r') SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 13-14: malformed \N character escape >>> from mycalc import * >>> I also ran 2to3 again and this time captured the output as what appears to be a diff file: ================================== E:\Python26\Tools\Scripts>2to3 -w mycalc.py > 2to3_at_work.txt RefactoringTool: Skipping implicit fixer: buffer RefactoringTool: Skipping implicit fixer: idioms RefactoringTool: Skipping implicit fixer: set_literal RefactoringTool: Skipping implicit fixer: ws_comma RefactoringTool: Files that were modified: RefactoringTool: mycalc.py E:\Python26\Tools\Scripts> ================================== You can see the file produced at <http://www.rcblue.com/Misc/2to3_at_work.txt> Dick _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor