def get_open_fds_count():
 pid = os.getpid()
 procs = check_output([u'lsof', u'-w', u'-Ff', u'-p', str(pid)])
 nprocs = len([s for s in procs.decode(u'utf-8').split(u'\n') if (s and (s[0] == u'f') and s[1:].isdigit())])
 return nprocs

def get_open_fds_count ( ) : pid = os . getpid ( ) procs = check_output ( [ u'lsof' , u'-w' , u'-Ff' , u'-p' , str ( pid ) ] ) nprocs = len ( [ s for s in procs . decode ( u'utf-8' ) . split ( u'\n' ) if ( s and ( s [ 0 ] == u'f' ) and s [ 1 : ] . isdigit ( ) ) ] ) return nprocs
return the number of open file descriptors for current process .