diff --git a/examples/sc2autosave.py b/examples/sc2autosave.py index fc40bb98..eb6b48e4 100755 --- a/examples/sc2autosave.py +++ b/examples/sc2autosave.py @@ -168,6 +168,11 @@ import sc2reader +try: + raw_input # Python 2 +except NameError: + raw_input = input # Python 3 + def run(args): #Reset wipes the destination clean so we can start over. @@ -367,12 +372,12 @@ def reset(args): elif not os.path.isdir(args.dest): exit("Cannot reset, destination must be directory: {0}", args.dest) - print 'About to reset directory: {0}\nAll files and subdirectories will be removed.'.format(args.dest) + print('About to reset directory: {0}\nAll files and subdirectories will be removed.'.format(args.dest)) choice = raw_input('Proceed anyway? (y/n) ') if choice.lower() == 'y': args.log.write('Removing old directory: {0}\n'.format(args.dest)) if not args.dryrun: - print args.dest + print(args.dest) shutil.rmtree(args.dest) else: sys.exit("Script Aborted") @@ -511,7 +516,7 @@ def main(): try: run(parser.parse_args()) except KeyboardInterrupt: - print "\n\nScript Interupted. Process Aborting" + print("\n\nScript Interupted. Process Aborting") if __name__ == '__main__': main() diff --git a/examples/sc2store.py b/examples/sc2store.py index cb8995c0..55ff22b0 100755 --- a/examples/sc2store.py +++ b/examples/sc2store.py @@ -172,15 +172,15 @@ def main(): for path in args.paths: for file_name in sc2reader.utils.get_files(path, depth=0): - print "CREATING: {0}".format(file_name) + print("CREATING: {0}".format(file_name)) db.add(Game(sc2reader.read_file(file_name), db)) db.commit() - print list(db.query(distinct(Person.name)).all()) + print(list(db.query(distinct(Person.name)).all())) #for row in db.query(distinct(Person.name)).all(): - # print row + # print(row) def load_session(args): diff --git a/new_units.py b/new_units.py index afe58f27..e0d80118 100644 --- a/new_units.py +++ b/new_units.py @@ -18,10 +18,10 @@ for line in new_units: new_unit_name = line.strip().split(',')[1] if new_unit_name not in UNIT_LOOKUP: - print "{0},{1}".format(new_unit_name,new_unit_name) + print("{0},{1}".format(new_unit_name,new_unit_name)) -print -print +print('') +print('') ABIL_LOOKUP = dict() for entry in pkgutil.get_data('sc2reader.data', 'ability_lookup.csv').split('\n'): @@ -33,4 +33,4 @@ for line in new_abilities: new_ability_name = line.strip().split(',')[1] if new_ability_name not in ABIL_LOOKUP: - print "{0},{1}".format(new_ability_name,new_ability_name) + print("{0},{1}".format(new_ability_name,new_ability_name)) diff --git a/sc2reader/scripts/sc2attributes.py b/sc2reader/scripts/sc2attributes.py index a318848f..da0160e9 100644 --- a/sc2reader/scripts/sc2attributes.py +++ b/sc2reader/scripts/sc2attributes.py @@ -38,6 +38,11 @@ import sc2reader +try: + raw_input # Python 2 +except NameError: + raw_input = input # Python 3 + decisions = dict()