mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Check that the file exists instead of raising an ugly Python exception.
This commit is contained in:
parent
e3632d8a64
commit
b8a27bbcd2
1 changed files with 7 additions and 1 deletions
8
main.py
8
main.py
|
@ -477,7 +477,13 @@ def main(argv):
|
|||
if fname == '-':
|
||||
script = sys.stdin.read()
|
||||
else:
|
||||
f = open(fname, 'r')
|
||||
try:
|
||||
f = open(fname, 'r')
|
||||
except IOError as e:
|
||||
if e.errno == 2:
|
||||
sys.stderr.write('Error: File not found: %s\n' % fname)
|
||||
return 2
|
||||
raise
|
||||
try:
|
||||
script = f.read()
|
||||
finally:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue