當我使用subprocess使用我的菜單腳本打開我的遊戲腳本時,出現奇怪的錯誤,即使我嘗試重新安裝python或pygame。我是否錯誤地使用了代碼?Subprocess not working〜打開遊戲腳本w/a菜單腳本
〜〜資料 Python版本2.7.6 Pygame的Verison 1.9.1
〜錯誤鑑於〜
> > Traceback (most recent call last): File "C:\Users\Jason\Desktop\Maze\menu.py", line 22, in <module>
> subprocess = Popen(['swfdump', 'main.py', '-d'], stdout=PIPE) File "C:\Python27\lib\subprocess.py", line 709, in __init__
> errread, errwrite) File "C:\Python27\lib\subprocess.py", line 957, in _execute_child
> startupinfo) WindowsError: [Error 2] The system cannot find the file specified
〜我使用我的菜單代碼〜
import pygame
import dumbmenu as dm
pygame.init()
from subprocess import Popen, PIPE
# Just a few static variables
red = 255, 0, 0
green = 0,255, 0
blue = 0, 0,255
size = width, height = 340,240
screen = pygame.display.set_mode(size)
screen.fill(blue)
pygame.display.update()
pygame.key.set_repeat(500,30)
choose = dm.dumbmenu(screen, [
'Start Game',
'Quit Game'], 64,64,None,32,1.4,green,red)
if choose == 0:
pprocess = Popen(['swfdump', 'main.py', '-d'], stdout=PIPE)
stdout, stderr = process.communicate()
elif choose == 1:
pygame.quit()
exit()