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`
This commit is contained in:
Marc Hartmayer 2019-08-08 18:50:40 +02:00
parent 0a6c0cd8fb
commit 2ed8395d6c
1 changed files with 1 additions and 1 deletions

View File

@ -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')