I have whole project to convert from Python 2.x to 3.x. So can I go ahead & convert it by just 2to3 module?
Asked
Active
Viewed 337 times
2 Answers
1
i think you can. maybe there will be some errors but it generly it will be going well

Matthijs990
- 637
- 3
- 26
-
So i tried using with multiple files. It worked fine with some modifications done by 2to3 Lib. But how can i test the script if that is successfully converted or not. As it is almost 1000 lines of code in it. – Hitesh Panjawani Mar 22 '19 at 06:56
-
just run it. if there are errors you will find them – Matthijs990 Mar 22 '19 at 10:30
-
and os_sys has a module os_sys.doc_maker.helper.HTMLdoc(path to folder with files) – Matthijs990 Mar 22 '19 at 10:34
-
it not only doc but also test – Matthijs990 Mar 22 '19 at 10:34
1
As you have said that you have to convert whole module there can be some warnings and some errors but they still refactoring is possible. For reference you can always go to "https://docs.python.org/2/library/2to3.html#module-lib2to3" and "https://docs.python.org/2/library/doctest.html".

Ritesh Kumar
- 26
- 3
-
What if didn't get any errors ? Does that mean my python file is successfully converted. – Hitesh Panjawani Mar 22 '19 at 06:52
-
Better to use static type checker as in mypy("http://mypy-lang.org/") or pytype (https://github.com/google/pytype) in your code and ensure that every function serves the purpose expected in both versions of python. – Ritesh Kumar Mar 24 '19 at 19:02