Strange os.popen() behavior
David Bolen
db3l at fitlinxx.com
Tue Jul 3 19:16:57 EDT 2001
Carsten Gaebler <clpy at snakefarm.org> writes:
> Hi there!
>
> I have a problem with a script that reads the contents of /etc/passwd from
> a remote host. It doesn't always seem to read all lines:
(...)
> If I enter the SSH command in a shell I always get all 969 lines of
> /etc/passwd (the file does not change over time). Any clues?
You might try also printing out the exit code of the child process
(the result from your pipe.close() call) - perhaps the ssh is being
interrupted or otherwise losing the connection?
Another thought might be to try explicitly coding a readline() loop
rather than the single call to readlines() to see if you notice any
difference? Perhaps there's some interaction with readlines() and the
pipe that makes it think it is done with data too early.
--
-- David
--
/-----------------------------------------------------------------------\
\ David Bolen \ E-mail: db3l at fitlinxx.com /
| FitLinxx, Inc. \ Phone: (203) 708-5192 |
/ 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \
\-----------------------------------------------------------------------/
More information about the Python-list
mailing list