def writeMasterFile(self, mstr):
        OUT_FILE = '_OUT_FILE'
        ASCII = 'ascii'
        mstr_io = self.preprocessFile(mstr)
        file_ios={}
        while True:
            try:
                command = mstr_io.readWord()
            except IOError:
                break
            if not command.endswith(OUT_FILE):
                raise ValueError('Invalid master file command: %s' % command)
            type_name = command[:-len(OUT_FILE)]
            obj_type = self.knownObjects[type_name]
            fn = mstr_io.readWord()

            format = mstr_io.readWord()
            if format != ASCII:
                raise ValueError((fn, format) % 'Format of %r not supported: %s')

            if fn in file_ios:
                file_io =file_ios[fn]
            else:
                fw = file(fn, 'w')
                file_io = WorkspaceIO(fw)
                file_ios[fn]=file_io

            self.writeToIO(obj_type,file_io)

        for f in file_ios.values():
            f.close()
dataset/ETHPy150Open uci-cbcl/tree-hmm/gmtkParam/__init__.py/Workspace.writeMasterFile/swapped operands of `%`