diff -r b4beaf0bccea -r 3d948d35d94f migration.py --- a/migration.py Wed Sep 23 15:32:17 2015 +0200 +++ b/migration.py Wed Oct 28 17:39:30 2015 +0000 @@ -26,6 +26,7 @@ import tempfile from os.path import exists, join, basename, splitext from itertools import chain +from warnings import warn from six import string_types @@ -350,7 +351,14 @@ pyname = splitext(basename(migrscript))[0] scriptlocals['__name__'] = pyname with open(migrscript, 'rb') as fobj: - code = compile(fobj.read(), migrscript, 'exec') + fcontent = fobj.read() + try: + code = compile(fcontent, migrscript, 'exec') + except SyntaxError: + # try without print_function + code = compile(fcontent, migrscript, 'exec', 0, True) + warn('[3.22] script %r should be updated to work with print_function' + % migrscript, DeprecationWarning) exec(code, scriptlocals) if funcname is not None: try: