From 2ed8395d6ce2adc6a252b68c310646707348f3a1 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Thu, 8 Aug 2019 18:50:40 +0200 Subject: [PATCH] master: fix TypeError Add a guard for the case `path == None`. This commit fixes `TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType` --- mitogen/master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mitogen/master.py b/mitogen/master.py index 48f82ab1..814f7019 100644 --- a/mitogen/master.py +++ b/mitogen/master.py @@ -462,7 +462,7 @@ class DefectivePython3xMainMethod(FinderMethod): return None path = getattr(mod, '__file__', None) - if not (os.path.exists(path) and _looks_like_script(path)): + if not (path is not None and os.path.exists(path) and _looks_like_script(path)): return None fp = open(path, 'rb')