Fix Windows freeze support. BONKERS.
This commit is contained in:
parent
d1b474962d
commit
1be060ab42
2 changed files with 11 additions and 8 deletions
|
@ -5,24 +5,28 @@ import webbrowser
|
|||
|
||||
from server import BAPSicleServer
|
||||
|
||||
|
||||
def startServer():
|
||||
|
||||
# On Windows calling this function is necessary.
|
||||
# Causes all kinds of loops if not present.
|
||||
multiprocessing.freeze_support()
|
||||
|
||||
server = multiprocessing.Process(target=BAPSicleServer)
|
||||
server.start()
|
||||
|
||||
while True:
|
||||
time.sleep(2)
|
||||
time.sleep(5)
|
||||
if server and server.is_alive():
|
||||
pass
|
||||
else:
|
||||
print("Server dead. Exiting.")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# On Windows, calling this function is necessary.
|
||||
# Causes all kinds of loops if not present.
|
||||
# IT HAS TO BE RIGHT HERE, AT THE TOP OF __MAIN__
|
||||
# NOT INSIDE AN IF STATEMENT. RIGHT. HERE.
|
||||
# If it's not here, multiprocessing just doesn't run in the package.
|
||||
# Freeze support refers to being packaged with Pyinstaller.
|
||||
multiprocessing.freeze_support()
|
||||
if len(sys.argv) > 1:
|
||||
# We got an argument! It's probably Platypus's UI.
|
||||
try:
|
||||
|
|
|
@ -18,7 +18,6 @@ from state_manager import StateManager
|
|||
from mutagen.mp3 import MP3
|
||||
|
||||
|
||||
|
||||
class Player():
|
||||
state = None
|
||||
running = False
|
||||
|
@ -357,7 +356,7 @@ def showOutput(in_q, out_q):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
multiprocessing.set_start_method("spawn", True)
|
||||
#multiprocessing.set_start_method("spawn", True)
|
||||
in_q = multiprocessing.Queue()
|
||||
out_q = multiprocessing.Queue()
|
||||
|
||||
|
|
Loading…
Reference in a new issue