Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Define print() function and raw_input for Python 3
  • Loading branch information
cclauss authored Aug 22, 2017
commit 0648ba183f923f7a7ac86c6eee30e26351595697
11 changes: 8 additions & 3 deletions examples/sc2autosave.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@

import sc2reader

try:
raw_input # Python 3
except NameError:
raw_input = input # Python 3


def run(args):
#Reset wipes the destination clean so we can start over.
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()