sfepy.base.reader module

class sfepy.base.reader.Reader(directory)[source]

Reads and executes a Python file as a script with execfile(), storing its locals. Then sets the __dict__ of a new instance of obj_class to the stored locals.

Example:

>>> class A:
>>>    pass
>>> read = Reader( '.' )
>>> instance_of_a = read( A, 'file.py' )

It is equivalent to:

>>> mod = __import__( 'file' )
>>> instance_of_a = A()
>>> instance_of_a.__dict__.update( mod.__dict__ )

The first way does not create the ‘file.pyc’…