[sc-users] fifos
Till Bovermann
tboverma at techfak.uni-bielefeld.de
Fri Apr 18 07:02:22 PDT 2008
Hey list,
still on this python-accessing problem... (thanx to all helping hands)
why doesn't this work?
any help appreciated
-------------- code -----------------
q = ();
q.path = "/tmp/";
q.sclang2AppName = "%/fifo_SC2App_%".format(q.path, this.hash);
q.fifos = [];
(
q.addFifo = {|fifoPath|
("mkfifo -m 700 %").format(fifoPath).systemCmd;
//"echo hahahaha >> %".format(fifoPath).systemCmd;
q.fifos = q.fifos ++ [fifoPath];
};
q.openFifoForRead = {|fifoPath|
q.in = File(fifoPath, "r").open
};
q.read = {
var line, result = "";
line = q.in.getLine;
while({line.notNil}, {
result = result + line;
line = q.in.getLine;
});
result;
};
q.write = {|str|
q.out.write(str); q.out.flush;
};
q.closeFifoForRead = {|fifoPath|
q.in.close
};
q.cleanUp = {
q.fifos.do{|path| "rm %".format(path).systemCmd };
q.fifos = [];
};
)
q[\addFifo].value(q.sclang2AppName)
q.in = q[\openFifoForRead].value(q.sclang2AppName)
// echo "hahahah" >> fifo_SC2App_<hasValue> will help to get sc out
of hybernation
-------- error message ---------------
ERROR: Primitive '_FileOpen' failed.
Wrong type.
RECEIVER:
Instance of File { (0E1780B0, gc=64, fmt=00, flg=00, set=01)
instance variables [1]
fileptr : RawPointer A0963DE0
}
CALL STACK:
MethodError:reportError 0DCABFB0
arg this = <instance of PrimitiveFailedError>
Nil:handleError 0DCABF50
arg this = nil
arg error = <instance of PrimitiveFailedError>
Thread:handleError 0DCABEF0
arg this = <instance of Thread>
arg error = <instance of PrimitiveFailedError>
Object:throw 0DCABE90
arg this = <instance of PrimitiveFailedError>
Object:primitiveFailed 0DCABD70
arg this = <instance of File>
File:open 0DCABE30
arg this = <instance of File>
arg pathName = nil
arg mode = nil
< closed FunctionDef > 0DCABCB0
arg fifoPath = "/tmp//fifo_SC2App_212659823"
< closed FunctionDef > (no arguments or variables)
Interpreter:interpretPrintCmdLine 16C773E0
arg this = <instance of Interpreter>
var res = nil
var func = <instance of Function>
var code = "q.in = q[\openFifoForRead].v..."
Process:interpretPrintCmdLine 0DCAB710
arg this = <instance of Main>
More information about the sc-users
mailing list