pwtools.common.get_filename

pwtools.common.get_filename(fh)[source]

Try to get the name attribute from file-like objects. If it fails (fh=cStringIO.StringIO(), fh=StringIO.StringIO(), fh=gzip.open(), …), then return a dummy name.