Commit 498ee6ae authored by Mario Hock's avatar Mario Hock

Raise WrongFileFormat_Exception on directories.

parent 4c043a29
...@@ -5,8 +5,7 @@ from io import StringIO ...@@ -5,8 +5,7 @@ from io import StringIO
import json import json
import csv import csv
import os
def merge_lists(first, second): def merge_lists(first, second):
""" """
...@@ -100,6 +99,9 @@ class CNLParser: ...@@ -100,6 +99,9 @@ class CNLParser:
def __init__(self, filename): def __init__(self, filename):
self.filename = filename self.filename = filename
if ( os.path.isdir(self.filename) ):
raise self.WrongFileFormat_Exception()
with open( self.filename ) as in_file: with open( self.filename ) as in_file:
## Check file format version. ## Check file format version.
if ( not in_file.readline() == "%% CPUnetLOGv1\n" ): if ( not in_file.readline() == "%% CPUnetLOGv1\n" ):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment