Skip to content

Commit 0648ba1

Browse files
author
cclauss
authored
Define print() function and raw_input for Python 3
1 parent 2ecd0b3 commit 0648ba1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

examples/sc2autosave.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@
168168

169169
import sc2reader
170170

171+
try:
172+
raw_input # Python 3
173+
except NameError:
174+
raw_input = input # Python 3
175+
171176

172177
def run(args):
173178
#Reset wipes the destination clean so we can start over.
@@ -367,12 +372,12 @@ def reset(args):
367372
elif not os.path.isdir(args.dest):
368373
exit("Cannot reset, destination must be directory: {0}", args.dest)
369374

370-
print 'About to reset directory: {0}\nAll files and subdirectories will be removed.'.format(args.dest)
375+
print('About to reset directory: {0}\nAll files and subdirectories will be removed.'.format(args.dest))
371376
choice = raw_input('Proceed anyway? (y/n) ')
372377
if choice.lower() == 'y':
373378
args.log.write('Removing old directory: {0}\n'.format(args.dest))
374379
if not args.dryrun:
375-
print args.dest
380+
print(args.dest)
376381
shutil.rmtree(args.dest)
377382
else:
378383
sys.exit("Script Aborted")
@@ -511,7 +516,7 @@ def main():
511516
try:
512517
run(parser.parse_args())
513518
except KeyboardInterrupt:
514-
print "\n\nScript Interupted. Process Aborting"
519+
print("\n\nScript Interupted. Process Aborting")
515520

516521
if __name__ == '__main__':
517522
main()

0 commit comments

Comments
 (0)