## Making python 2 and 3 compatible: ### Import above everything from __future__ import print_function ### All print statements have to have brackets, like print("sint") ### Exceptions need to be in brackets as well raise ValueError("dodgy value") ### Integer division ####python 2 currently rounds down, i.e. 2/3==0 not 0.66, while python 3 does true division ####rounding down in both python 2 and 3 is 2//3, thus with two slashes ####to run true division in python 2 and 3 from __future__ import division # (at top of module) #### and then use simply one slashassert 3 / 2 == 1.5 #### so far I have circumvented this problem by using a dot after integer (e.g. 2. instead of 2). So maybe try and fix this ### Imports relative to a package ####Suppose the package is: mypackage/ __init__.py submodule1.py submodule2.py ####and the code below is in submodule1.py: #### Python 2 only: import submodule2 #### Python 2 and 3: from . import submodule2 ### Change all ranges to list(range) as otherwise it will use the range from python3