isfifo?

2009-02-07 Thread rdmurray
I've googled and looked through os.path, but I don't see a method for
determining if a path points to a FIFO.  Anyone know of a simple way to
do so?

--RDM

--
http://mail.python.org/mailman/listinfo/python-list


Re: isfifo?

2009-02-07 Thread Albert Hopkins
On Sat, 2009-02-07 at 17:12 +, rdmur...@bitdance.com wrote:
 I've googled and looked through os.path, but I don't see a method for
 determining if a path points to a FIFO.  Anyone know of a simple way to
 do so?

import os
import stat

st_mode = os.stat(path)[0]
isfifo = stat.S_ISFIFO(st_mode)


--
http://mail.python.org/mailman/listinfo/python-list


Re: isfifo?

2009-02-07 Thread Martin v. Löwis
rdmur...@bitdance.com wrote:
 I've googled and looked through os.path, but I don't see a method for
 determining if a path points to a FIFO.  Anyone know of a simple way to
 do so?

def isfifo(fn):
  return stat.S_ISFIFO(os.stat(fn).st_mode)

HTH,
Martin
--
http://mail.python.org/mailman/listinfo/python-list


Re: isfifo?

2009-02-07 Thread rdmurray
=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= mar...@v.loewis.de wrote:
 rdmur...@bitdance.com wrote:
  I've googled and looked through os.path, but I don't see a method for
  determining if a path points to a FIFO.  Anyone know of a simple way to
  do so?
 
 def isfifo(fn):
   return stat.S_ISFIFO(os.stat(fn).st_mode)

Thanks.  I should have thought of looking in os.stat.  Odd that S_ISFIFO
didn't come up in my google search.

--RDM

--
http://mail.python.org/mailman/listinfo/python-list