This change fixes the error OSError: [WinError 193] on Windows debuggers (i.e. PyCharm) (#11034)

This commit is contained in:
tringler 2017-12-10 01:58:52 +01:00 committed by Paulus Schoutsen
parent cb4e886a4f
commit 4e91e6d103

View file

@ -230,7 +230,7 @@ def closefds_osx(min_fd: int, max_fd: int) -> None:
def cmdline() -> List[str]:
"""Collect path and arguments to re-execute the current hass instance."""
if sys.argv[0].endswith(os.path.sep + '__main__.py'):
if os.path.basename(sys.argv[0]) == '__main__.py':
modulepath = os.path.dirname(sys.argv[0])
os.environ['PYTHONPATH'] = os.path.dirname(modulepath)
return [sys.executable] + [arg for arg in sys.argv if