Check if file is a named pipe (fifo) in python?

pipe, python

Solution

You can try:

 import stat, os

 stat.S_ISFIFO(os.stat(path).st_mode)

docs

Problem

I communicate with a named pipe, but I would like to check if it really is a named pipe BEFORE opening it. I check in Google but there is nothing, `os.path.isfile()` returns `False`, and I really need to check it.

Original source