Andre Roberge wrote: > On 4/25/06, Hugo González Monteverde <[EMAIL PROTECTED]> wrote: > >> Remember duck typing. An object just needs to look like a file in order >> to be used like one. >> >> Guido's time machine has already forseen your problem. Take a look at >> the StringIO module. It allows you to use a string where you would >> normally pass a file object. >> >> > > Since I do something like > os.open("python some_file.py > some_output") > I don't see how I can pass a file-like object. As far as I can tell > "python" (the command) looks for a real file on the current path. > How about using one of the os.popen functions, that returns a file-like object for stdout? > André > > >> Hope that helps, >> >> Hugo >> >> >>> ###### >>> While this works, I find it "messy", as it creates some intermediate >>> files. I was wondering if there was a better way to do things all in >>> memory, in an OS independent way. >>> >>> [Note that the complete application is approximately 665 lines long >>> ... a bit too much >>> to post all here :-)] >>> >>> André >>> _______________________________________________ >>> Tutor maillist - Tutor@python.org >>> http://mail.python.org/mailman/listinfo/tutor >>> >>> > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor