converting py to exe using cz_freeze

118 views Asked by At

I am trying to convert my python file into an exe file. Currently i am using cz_freeze but its not working. Though there is no error but the build directory which should have been created is not happening.

PS: Not sure if its relevant but i am running windows on virtual box on a mac system.

this is my setup.py file

from cx_Freeze import setup, Executable
import sys

base = None

if sys.platform == 'win32':
    base = None


executables = [Executable("untitled.py", base=base)]

packages = ["idna"]
options = {
    'build_exe': {

        'packages':packages,
    },

}

setup(
    name = "<any name>",
    options = options,
    version = "<any number>",
    description = '<any description>',
    executables = executables
)

this is my main file(untitled2.py)

import quickstart

a=input("username:")
b=input("samrat_id")
c=input("true:")
def function():
    quickstart.update_spreadsheet(a,b,c)
function()

this is my another python file which i am importing in my main untitled2.py file

import gspread
import os
import datetime
import time


from oauth2client.service_account import ServiceAccountCredentials

#to find next available row 
def next_available_row(sheet):
    str_list = list(filter(None, sheet.col_values(1)))  # fastest
    return str(len(str_list)+1)

# use creds to create a client to interact with the Google Drive API
def update_spreadsheet(username,SAMRAT_id,test_result):
    scope = ['https://spreadsheets.google.com/feeds']
    basedir = os.path.abspath(os.path.dirname(__file__))
    DATA_JSON = basedir+'/'+'client_secret.json'
    creds = ServiceAccountCredentials.from_json_keyfile_name(DATA_JSON, scope)

    client = gspread.authorize(creds)

    # Find a workbook by name and open the first sheet
    # Make sure you use the right name here.
    sheet = client.open("TESTING REPORT")
    worksheet=sheet.worksheet("INTEGRATION TEST")
    next_row = next_available_row(worksheet)



    count=int(next_row)
    count-=1


    #insert on the next available row
    date_today=datetime.date.today()
    time_today=time.strftime("%H:%M:%S")

    worksheet.update_acell("A{}".format(next_row), count)
    worksheet.update_acell("B{}".format(next_row), date_today)
    worksheet.update_acell("C{}".format(next_row), time_today)
    worksheet.update_acell("D{}".format(next_row), SAMRAT_id)
    worksheet.update_acell("E{}".format(next_row), test_result)
    worksheet.update_acell("G{}".format(next_row), username)

I also have a json file which i am loading in quickstart.py file and which is needed for the program to run. And please free suggest another converter.

0

There are 0 answers