2017-06-11 66 views
1

爲什麼我得到這個錯誤。 Screenshot of error msg主腳本中的cxFreeze python錯誤

它說主要腳本中的python錯誤, 在64行結束;運行時錯誤

import sys 
#import os 
from cx_Freeze import setup,Executable 

base = None 

if sys.platform == "win32": 
    base = "win32GUI" 

#os.environ['TCL_LIBRARY'] = r'C:\Users\asus\AppData\Local\Programs\Python\Python36-32\tcl\tcl8.6' 
#os.environ['TK_LIBRARY'] = r'C:\Users\asus\AppData\Local\Programs\Python\Python36-32\tcl\tk8.6' 

setup(name="aplication", 
     version="0.1", 
     description="app", 
     executables=[Executable("TICTACTOE.py", base=base)]) 

我還是個學生,無法弄清楚這個錯誤

我的主要腳本在沒有錯誤的殼運行。

這裏是一個腳本

import copy as c 
import sys 

def printBoard(arg): 
    i = 0 
    for v in arg.keys(): 
     i += 1 
     if i % 3 == 0 and i < 9: 
      print(arg[v],'\n- + - + -') 
     elif i==9: 
       print(arg[v]) 
     else: 
      print(arg[v],'','|',end=' ') 



def check(b,arg): 
    def plagfn(b): 
     global looper 
     looper = False 
     plag = input('Play again? y/n ') 
     if plag == 'Y': 
      theBoard=c.copy(newBoard) 
     else: 
      sys.exit() 
    val = list(b.values()) 
    l=['','','','','','','','',''] 
    u=c.copy(l) 
    d=c.copy(l) 
    for i in [0,3,6]: 
     l[i] = (val[i] == val[i+1] == val[i+2] == arg) 
    for i in range(3): 
     u[i] = (val[i] == val[i+3] == val[i+6] == arg) 
    for i in [0,2]: 
     d[i] = (val[i] == val[4] == val[8-i] == arg) 
    if ('' not in b.values()): 
     print('Its draw !') 
     plagfn(b) 
    if (True in l) or (True in u) or (True in d): 
     print(arg , 'is a winner !') 
     plagfn(b) 


while True: 
    theBoard = {'TL': '', 'TM': '', 'TR': '', 
       'ML': '', 'MM': '', 'MR': '', 
       'LL': '', 'LM': '', 'LR': ''} 
    sample={} 
    for bld1 in theBoard.keys(): 
     sample[bld1]=bld1 
    newBoard=c.copy(theBoard)     
    print('The viable inputs are \n') 
    printBoard(sample) 
    print('\nStart') 
    printBoard(theBoard) 
    looper = True 
    i=0 
    while looper: 
     i += 1 
     if i % 2 == 0: 
      arg = 'O' 
     else: 
      arg = 'X' 
     v = input('\nYour turn ' + str(arg) + '! \n') 
     while v not in list(theBoard.keys()): 
      print('The viable inputs are \n') 
      printBoard(sample) 
      v = input('\nYour turn ' + str(arg) + '! \n') 
     while theBoard[v] : 
      print('Already played.') 
      v = input('Your turn ' + str(arg) + '! \n') 
     theBoard[v]=arg 
     printBoard(theBoard) 
     check(theBoard,arg) 

謝謝您的時間。

回答

0

這應有助於:

import sys 

from cx_Freeze import setup, Executable 

setup(name="aplication", 
     version="0.1", 
     description="app", 
     executables=[Executable("TICTACTOE.py", base="Console")]) 
+0

它的工作表示感謝。 –