On Thu, Sep 20, 2012 at 7:09 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > You could do: > > os.listdir("/proc/%d/fd" % os.getpid()) > > This should work on Linux, AIX, and Solaris, but obviously not on Windows.
I'm not sure how cross-platform it is, but at least on Linux, you can use /proc/self as an alias for "/proc/"+os.getpid() - worth a try, might make your code a bit easier to read. It's documented as useful when you don't know the PID yet (eg telling a process to read the file /proc/self/fd/0 to force it to use stdin). So I'm confident enough to recommend testing it. :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list