mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-21 22:48:16 +01:00
check if server is running under windows to fix issue with mqtt under win and python 3.9
This commit is contained in:
parent
a16c14feca
commit
db4e75525f
2 changed files with 8 additions and 1 deletions
|
@ -1 +1 @@
|
||||||
__version__ = "4.0.2.0.a11"
|
__version__ = "4.0.2.0.a12"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import sys
|
||||||
|
from asyncio import set_event_loop_policy, WindowsSelectorEventLoopPolicy
|
||||||
import json
|
import json
|
||||||
from voluptuous.schema_builder import message
|
from voluptuous.schema_builder import message
|
||||||
from cbpi.api.dataclasses import NotificationType
|
from cbpi.api.dataclasses import NotificationType
|
||||||
|
@ -82,6 +84,11 @@ async def error_middleware(request, handler):
|
||||||
class CraftBeerPi:
|
class CraftBeerPi:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
|
operationsystem= sys.platform
|
||||||
|
if operationsystem.startswith('win'):
|
||||||
|
set_event_loop_policy(WindowsSelectorEventLoopPolicy())
|
||||||
|
|
||||||
self.path = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-1]) # The path to the package dir
|
self.path = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-1]) # The path to the package dir
|
||||||
|
|
||||||
self.version = __version__
|
self.version = __version__
|
||||||
|
|
Loading…
Reference in a new issue