Ignore:
Timestamp:
Feb 8, 2010 5:13:22 PM (10 years ago)
Author:
wehart
Message:

Setting up 'import' tests for the other simple examples.
These seem to work, but the internal code is too ugly. I'm
going to clean that up next to help explain what is going on...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/data/sheet.py

    r2274 r2289  
    3737            return
    3838        tmp = self.sheet.get_range(self.options.range, raw=True)
    39         if type(tmp) in (int,long,float):
    40             self._info = ["param",self.options.param,":=",tmp]
     39        if len(tmp) == 0:
     40            raise IOError, "Empty range '%s'" % self.options.range
     41        elif type(tmp) in (int,long,float):
     42            if not self.options.param is None:
     43                self._info = ["param",self.options.param,":=",tmp[0][0]]
     44            elif len(self.options.symbol_map) == 1:
     45                self._info = ["param",self.options.symbol_map[self.options.         symbol_map.keys()[0]],":=",tmp]
     46            else:
     47                raise IOError, "Data looks like a parameter, but multiple parameter names have been specified: %s" % str(self.options.symbol_map)
    4148        else:
    4249            self._set_data(tmp[0], tmp[1:])
Note: See TracChangeset for help on using the changeset viewer.