|
From: Norman H. <hen...@in...> - 2001-08-21 10:08:34
|
Hello, sorry for asking a dumb question. I would like to read Jython skripts from arbitrary Java InputStreams, not just from local files. The jyhton class documentation lists the method I need: http://www.jython.org/docs/api/org/python/util/PythonInterpreter.html#execfile(j ava.io.InputStream) but there are no details, and the method does not seem to work. What am I doing wrong, or should I just wait a little? Thanks in advance, Norman. --- jython log while trying execfile(InputStream) --- tech41> ~/java/jython-2.0/jython Jython 2.0 on java1.3.0rc1 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> print 2*3+4 10 >>> from java.io import FileInputStream >>> execfile( FileInputStream( "demo.py" )) Traceback (innermost last): File "<console>", line 1, in ? TypeError: execfile(): 1st arg can't be coerced to String >>> execfile( "demo.py" ) [output deleted: skript works...] >>> fis = FileInputStream( "demo.py" ) >>> print fis.read() [reading the stream works...] [ now trying again...] >>> fis = FileInputStream( "demo.py" ) >>> execfile( fis ) Traceback (innermost last): File "<console>", line 1, in ? TypeError: execfile(): 1st arg can't be coerced to String |