This is an old copy of the Python FAQ. The information here may be outdated.

I can't seem to use os.read() on a pipe created with os.popen(); why?

os.read is a low-level function which takes a file descriptor, a small integer representing the opened file. os.popen creates a high-level file object, the same type returned by the open function. Thus, to read n bytes from a pipe p created with os.popen, you need to use p.read(n).

CATEGORY: library

 

A Django site. rendered by a django application. hosted by webfaction.