morshu-server: fix startup by passing env and using sys.executable

This commit is contained in:
2026-06-06 19:48:27 -05:00
parent c9e9b7c91e
commit 33aa6aba33
+6 -1
View File
@@ -1,4 +1,5 @@
import os import os
import sys
import shutil import shutil
import logging import logging
import asyncio import asyncio
@@ -527,10 +528,14 @@ class TtsToy(Cog):
log.error(f"Morshu server not found: {server_py}") log.error(f"Morshu server not found: {server_py}")
return False return False
env = os.environ.copy()
env['PORT'] = str(self.morshu_port)
self.morshu_process = await asyncio.to_thread( self.morshu_process = await asyncio.to_thread(
subprocess.Popen, subprocess.Popen,
["python3", "server.py"], [sys.executable, "server.py"],
cwd=str(self.morshu_dir), cwd=str(self.morshu_dir),
env=env,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
text=True text=True