# How to get the system configuration information relevant to an open file using Python?

PythonServer Side ProgrammingProgramming

You can call the fpathconf(file_descriptor, name) function to get the system configuration information relevant to an open file. name specifies the configuration value to retrieve; it may be a string which is the name of a defined system value; these names are specified in a number of standards. Note that this function is only available on Unix systems. For example,

import os, sys
# Open a file
fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT )
# Now get maximum number of links to the file.
os.close( fd)
Maximum number of links to the file. :127
Maximum length of a filename :255