in other words, the last two lines of your function should be:
statinfo = os.stat(filename)
return child_pty.read(statinfo.st_size)
--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com
--
http://mail.python.org/mailman/listinfo/python-list
#better coded for you to understand
import sys
import pty
import os
def get_text(filename):
try:
( child_pid, fd ) = pty.fork() # OK
except OSError as e:
print(str(e))
sys.exit(1)
if child_pid == 0:
import sys
import pty
import os
def get_text(filename):
#you need to find the file size, and place it as an integer in read
below, where you return the value
statinfo = os.stat(filename)
try:
( child_pid, fd ) = pty.fork() # OK
except OSError as e:
On Tue, Oct 23, 2012 at 11:41 PM, Evan Driscoll wrote:
> OK, one more self-reply. :-)
>
> I found http://bugs.python.org/issue5380 which seems to be relevant. Sounds
> like the OS is returning an error, and that's naturally being propagated
> through Python. And further testing reveals the problem
OK, one more self-reply. :-)
I found http://bugs.python.org/issue5380 which seems to be relevant.
Sounds like the OS is returning an error, and that's naturally being
propagated through Python. And further testing reveals the problem only
surfaces when the child actually exits -- if the child
I have the following program. Everything is sunshine and rainbows when I
run in in Python 2, but when I run it under Python 3 I get an IOError.
2to3 only reports one dumb suggestion re. a print call (which I can get
rid of by importing __future__'s print_function, and then it just
suggests remo
Oh, and a little more information:
The log.txt file I create has the message that it's "about to execlp",
and the exec() *does* actually happen -- the IOError is raised after the
child process quits.
Evan
On 10/23/2012 09:59 PM, Evan Driscoll wrote:
I have the following program. Everything