Project Description:

Similar to Project 1, this project focuses on solving the compatible issue between Python 2 and Python 3. A list of Python files, which are used in PSS®E, is needed to be checked for Python 2/3 dependencies. In this project, we have to use “compileall” to compile the files in both Python 2.7 and Python 3.2. The codes should work fine for Python 2. But the company is looking for codes that will work in either version of Python. So, the further modification is needed. We have to:

  1. Identify the Python 3 problems.
  2. Use the Py2to3 tools for suggestions on equivalent Python 3 code.
  3. Identify simple code fixes that would eliminate version issues where that is possible.
  4. Develop a module of functions that would encapsulate versioning logic where necessary.
  5. Report to manager where we think one of those two alternatives will not work and the manager will decide how to handle it.

Project Environment: Python 3.2, Python 2.7, Command Prompt

Project Length: 5 weeks (still in process)

Project Result:

All the files are compiled by both Python 2.7 and Python 3.2.

All compatible issues are identified and recorded.

  • “print” is no longer a statement, but a function.
  • “String” is all in Unicode. So, u’string’ no long works.
  • NE (not equal) is no longer <>, but !=.
  • keys() has to be wrapped in a call to list
  • Import cStringIO -> io
  • _winreg-> winreg
  • Execfile-> exec
  • Tkinter-> tkinter

Solution to each compatible issues is figured.

Further tests are still needed to assure the code works in all conditions.

Lessons Learnt:

The compatible issue is a big problem in software design and implementation. The project teaches me how to solve these compatible issues. Most importantly, I understand the method to identify these problems.

Python and Command Prompt are required for this project. The coding experience helps me in programming skill, understanding documentation, and software implementation.