[pypy-dev] RPython I/O
cumber at netspace.net.au
Wed Mar 18 07:45:33 CET 2009
Thanks! Got it working now.
If I do:
stdin_fd = sys.stdin.fileno()
during import time and then use that with os.read (either directly or
indirectly through streams), will it also be translated correctly for the other
> There are two official ways:
> 1. use directly os.read/os.open/os.write, rather tedious if you ask me
> 2. use interfaces that are present in pypy/rlib/streamio.py. I think
> only documentation for that is in tests unfortunately :(
> It has interface similar to python's streams, but adapted a bit to
> accomodate rpythonism.
> On Tue, Mar 17, 2009 at 10:03 AM, Ben Mellor <cumber at netspace.net.au> wrote:
> > Hi
> > Just wondering, what's the right way to do IO in an RPython program?
> > sys.stdin/sys.stdout don't work, neither does opening files using open(),
> > and raw_input doesn't work. All I can get is print. I can't find anything
> > about this in the docs, and I haven't been able to understand how the PyPy
> > interpreter is doing it from looking at the source code so far.
> > I've been playing around with using the PyPy framework to implement a small
> > interpreter, and this is currently blocking me from translating it.
> > -- Ben Mellor
> > _______________________________________________
> > pypy-dev at codespeak.net
> > http://codespeak.net/mailman/listinfo/pypy-dev
More information about the Pypy-dev