0
私は作っているテキストゲームのランチャーを作ろうとしましたが、私が選んだ拡張子に基づいてゲームの一部を実行するためにランチャーが必要です。しかし、ランチャーを作成してテストした後、ランチャーが別のPythonプログラムを実行するはずの部分まですべてがうまく動作することに気付きました。プログラムを実行するのではなく、ただ終了し、私はなぜそれがわからないのですか?ここに私のコードは次のとおりです。subprocess.Popenは私のpythonプログラムを実行しません
import easygui as e
import os
import subprocess
def Launch():
expansions = []
file = open("dlc.txt")
reading = True
while reading == True:
temp = file.readline().strip()
if temp == "":
reading = False
elif temp == "The Forgotten Lands":
expansions.append("The Forgotten Lands (Main Game)")
else:
expansions.append(temp)
game = e.choicebox("Welcome to The Forgotten Lands launcher. Please pick an expansion.","Launcher",choices=expansions)
if game is None:
os._exit(0)
else:
if game == "The Forgotten Lands (Main Game)":
game = "The Forgotten Lands"
dir_path = os.path.dirname(os.path.realpath(__file__))
filepath = (dir_path + "/" + game + "/" + game + ".py")
filepath = filepath.replace("/", "\/")
filepath = filepath.replace("/", "")
subprocess.Popen(filepath, shell=True)
Launch()
これは、感謝しました! – PHDBanana