Changeset 439

Show
Ignore:
Timestamp:
10/14/09 14:19:04 (3 years ago)
Author:
apdavison
Message:

Tiny change in parameters module to give better error message

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/parameters.py

    r382 r439  
    159159     
    160160    @staticmethod 
    161     def read_from_str(str): 
    162         """ 
    163         ParameterSet definition str should be a Python dict definition 
     161    def read_from_str(s): 
     162        """ 
     163        ParameterSet definition s should be a Python dict definition 
    164164        string, containing objects of types int, float, str, list, 
    165165        dict plus the classes defined in this module, `Parameter`, 
     
    187187                                pi=numpy.pi))             
    188188        try: 
    189             D = eval(str, global_dict) 
    190         except SyntaxError: 
    191             raise SyntaxError("Invalid string for ParameterSet definition: %s" % str) 
     189            D = eval(s, global_dict) 
     190        except SyntaxError, e: 
     191            raise SyntaxError("Invalid string for ParameterSet definition: %s\n%s" % (s,e)) 
    192192        return D or {} 
    193193