0

I want to convert my python program to a exe file but then i want to be able to click on a file with a certain extension such as .ftf and then be able to open the file in my python program and read the contents. I am also on a windows 10 computer that can't use cmd but can use some os module commands So ive done a bit of research and im still not clear in how to get the file name and path of the extension file i want to run with the python file but i am converting the python file to a exe so how do i gte the file name and path of the extension file open it then read its contents as a exe file. So i tried to convert my porgram to EXE and run the extension file with th exe version of my program and i got this error:

Traceback (most recent call last):
  File "D:\Users\Dextron\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\initscripts\__startup__.py"
, line 14, in run
    module.run()
  File "D:\Users\Dextron\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\initscripts\Console.py", li
ne 26, in run
    exec(code, m.__dict__)
  File "BashFile.py", line 18, in <module>
  File "D:\Users\Dextron\AppData\Local\Programs\Python\Python36-32\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 2: character maps to <undefined>

I have used cx_Freeze to convert my program. Here is my setup file

from cx_Freeze import setup, Executable
import os

base = None

executables = [Executable("BashFile.py", base=base)]
packages = ["os", "colorama", "datetime", "time", "socket", "random", "sys", "ctypes"]
options = {
    'build_exe': {
        'packages':packages,
    },
}

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

setup(
    name = "BashFile",
    options = options,
    version = "1.0",
    description = "A Simple Python program made to replace CMD",
    executables = executables
)
Dextron
  • 598
  • 7
  • 24

0 Answers0