From dde435cc1669ec6c11771e5975a858abfb636469 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sun, 21 Feb 2010 14:30:26 +0100 Subject: [PATCH] Do not run file(1) on non-existing files. --- patoolib/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patoolib/util.py b/patoolib/util.py index cdb87a7..01179ac 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -47,7 +47,7 @@ def guess_mime (filename): """Guess the MIME type of given filename. Uses first mimetypes and then file(1) as fallback.""" mime, encoding = mimedb.guess_type(filename, strict=False) - if mime is None: + if mime is None and os.path.isfile(filename): cmd = ["file", "--brief", "--mime-type", filename] try: mime = backtick(cmd).strip()