Sfoglia il codice sorgente

Now, when a non-existing file is opened, an exception is raised.

Taddeus Kroes 14 anni fa
parent
commit
744612234b
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      src/parser.py

+ 1 - 1
src/parser.py

@@ -123,6 +123,6 @@ def parse_file(filename):
         content = open(filename).read()
         yacc.parse(content)
     except IOError:
-        print 'File "%s" could not be opened' % filename
+        raise Exception('File "%s" could not be opened' % filename)
 
     return Block(statements)