Reputation: 197
I've seen similar problems on different forums, but none applies to this.
I have two files, one 'main.py' and the main program 'xlsKonverter.py' which I want to use cx_freeze to compile to an .exe file. When building the .exe I get this error message:
pywintypes.error: (110, 'EndUpdateResource', 'The system cannot open the device or file specified.')
And when trying to run the (somewhat finished) build, this Exception pops up:
I've tested all of my code, so the error is not there. It must be somewhere within the setup file. Am I wrong? And what would be a good fix?
'setup.py'
This is my cx_freeze setup
import sys
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
packages = ['xlrd', 'glob', 'sys']
includes = ['xlsKonverter']
includefiles = []
eggsacutibull = Executable(
script = "main.py",
base = 'Console',
initScript = None,
targetName = "main.py",
compress = True,
copyDependentFiles = True,
appendScriptToExe = False,
appendScriptToLibrary = False,
icon = None
)
setup( name = "Table Converter",
version = "0.3",
author = "Jørgen Sirhaug",
description = "Makes a .csv file from designated Wire List.",
options = {"build_exe": build_exe_options},
executables = [eggsacutibull]
)
'main.py'
, my main function
import xlsKonverter as xk
import os.path
import sys
def main():
fileList = xk.getAllFileURLsInDirectory("C:\\Users\\Jørgen\\Dropbox\\Aker\\Wire Lists\\")
if len(fileList) < 1:
print("ERROR! No files in directory!\nDoes the specified folder excist?")
else:
print('')
for i in range(len(fileList)):
try:
sheet = xk.getWorksheet(fileList[i])
tagCols = xk.automaticFirstRow(sheet)
pairedList = xk.pairCells(sheet, tagCols)
csvString = xk.makecsv(pairedList)#, tagCols)
xk.writeToFile(csvString, i)
except:
print("ERROR!\n" + fileList[i] + '\nThis file does not excist!')
main()
and the imports from 'xlsKonverter.py'
import xlrd
import glob
import sys
Upvotes: 0
Views: 954
Reputation: 40330
Try putting an encoding declaration in your main.py file. That's a comment that looks like this:
# encoding: cp1252
You might have to change the last bit depending on how you're saving the file. If it's created on Windows, cp1252 is normal for Western Europe. On Linux and Mac, utf8
is more common.
Upvotes: 1