Agent_T
Agent_T

Reputation: 31

cxFreeze python error in main script

why I'm getting this error. Screenshot of error msg

It says python error in main script, at the end at line 64; runtime error

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)])

I'm still a learner, Unable to figure out this error

My main script runs in the shell with no error.

Here is a script

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)

Thank you for your time.

Upvotes: 1

Views: 497

Answers (1)

ErvingGoffman
ErvingGoffman

Reputation: 189

This should help:

import sys

from cx_Freeze import setup, Executable

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

Upvotes: 1

Related Questions