Changeset 4971f63 in flex_extract.git for source/python/classes/ControlFile.py


Ignore:
Timestamp:
Sep 27, 2018, 12:31:47 PM (16 months ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
dev
Children:
82b624a
Parents:
25b14be
Message:

eliminated some redundancy and exchanged CONTROL2 with the config-filename

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/python/classes/ControlFile.py

    r25b14be r4971f63  
    180180
    181181        # read whole CONTROL file
    182         with open(os.path.join(_config.PATH_CONTROLFILES,
    183                                self.controlfile)) as f:
    184             fdata = f.read().split('\n')
     182
     183        try:
     184            with open(os.path.join(_config.PATH_CONTROLFILES,
     185                                   self.controlfile)) as f:
     186                fdata = f.read().split('\n')
     187        except IOError:
     188            print('Could not read CONTROL file "' + args.controlfile + '"')
     189            print('Either it does not exist or its syntax is wrong.')
     190            print('Try "' + sys.argv[0].split('/')[-1] + \
     191                      ' -h" to print usage information')
     192            sys.exit(1)
    185193
    186194        # go through every line and store parameter
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG