25

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.

johnsyweb
  • 136,902
  • 23
  • 188
  • 247
Mykeul
  • 473
  • 1
  • 5
  • 10

1 Answers1

38

You can try:

 import stat, os

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

docs

soulcheck
  • 36,297
  • 6
  • 91
  • 90