Changeset 4575


Ignore:
Timestamp:
08/03/11 22:38:27 (3 years ago)
Author:
wehart
Message:

Moving validation that the data files exist before the module file is imported.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/scripting/util.py

    r4300 r4575  
    236236        ep.apply( options=options ) 
    237237    # 
     238    # Verify that files exist 
     239    # 
     240    for file in [options.model_file]+options.data_files: 
     241        if not os.path.exists(file): 
     242            raise IOError, "File "+file+" does not exist!" 
     243    # 
    238244    filter_excepthook=True 
    239245    options.usermodel = pyutilib.misc.import_file(options.model_file) 
     
    276282        print "Initial set of objects:" 
    277283        summary.print_(memory_data.summary_before_instance_creation,limit=50) 
    278     # 
    279     # Verify that files exist 
    280     # 
    281     for file in [options.model_file]+options.data_files: 
    282         if not os.path.exists(file): 
    283             raise IOError, "File "+file+" does not exist!" 
    284284    # 
    285285    # Create Model 
Note: See TracChangeset for help on using the changeset viewer.