Skip to content

Commit

Permalink
Fixed checkwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuterin committed Nov 18, 2014
1 parent 9cb80fb commit 4afd19a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyethsaletool.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,22 @@ def ask_for_seed():


def checkwrite(f, thunk):
exit = False
try:
open(f)
# File already exists
if not options.overwrite:
s = "File %s already exists. Overwrite? (y/n) "
are_you_sure = raw_input(s % f)
if are_you_sure not in ['y', 'yes']:
sys.exit()
exit = True
except:
# File does not already exist, we're fine
pass
open(f, 'w').write(thunk())
if exit:
sys.exit()
else:
open(f, 'w').write(thunk())


w = tryopen(options.wallet)
Expand Down

0 comments on commit 4afd19a

Please sign in to comment.