Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: modified preparatory statements

...

First step is to add these statements to the very top of each .py file:

from __future__ import print_function
import sys
USING_PYTHON2 = sys.version_info[0] < 3
if USING_PYTHON2:
    from __future__ import print_function

If your .py file starts with a #! invocation statement, place those lines AFTER the shbang:

#!/usr/bin/env python
from __future__ import print_function

import sys
USING_PYTHON2 = sys.version_info[0] < 3
if USING_PYTHON2:
    from __future__ import print_function

These lines do two things:

...