cx_freeze executable runs from cmd but not on click - python-3.x

After dealing with all .egg issues with cx_freeze, I'm having issues running the .exe on click or from .bat. If I run the .exe from cmd, it runs perfectly. But if I click on the .exe, I get a popup list of errors that goes off the page.
I've tried changing the base=None and base=Win32GUI to no avail.
I'm running python 3.4 from and Anaconda environment. The errors make it look like on running, the .exe is looking in the normal python path, but there are references the the correct python path as well.
Any experiences with this?
Error from clicking. This goes off the screen so I can't see the final error:
error

Related

Tkinter video player library works fine as script but has issue when converted into an exe. (Failed to execute script due to unhandled exception)

I wrote a python program that uses the library tkVideoPlayer (and others). The python script runs fine without any errors but when I use pyinstaller to convert it into an exe, the exe doesn't run at all and I get the following error. (see image)
Things I have tried already:
Locating the file and moving it to the folder my exe is in.
Using a star import for the library
Using the --hidden option when creating the exe and specifying av/av.libs
Issue occurred due to me using Anaconda 3 (Sypder). It was using a virtual Environment and pyinstaller failed to locate the library correctly.
Solution: Installed python 3 directly onto windows, then installed pyinstaller and and all the libraries I used. Since that isn't a virtual environment it worked fine and the exe ran perfectly.

os.popen doesn't work after compiler with pyinstaller

The following line is what I'm using to open the file in python, and this action called by a button(tkinter).
os.popen(r'"C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe" %s' %filename)
My development environment is Python3.7 + spyder 3.3.1 + windows 7 + latest version pyinstaller.
The issue is that this line can work well in spyder, but after compiler.
pyinstaller -F -w --onefile --icon=icon.ico ./DMS.py
I used this command to compile the Python script. When I click the button which I mentioned above, there is no any action be executed and no any error message pop up. I'm sure the application didn't hang on or crush.
When I try the following command to check what message on console.
pyinstaller -F DMS.py
The miracle happen, the PDF file can be opened without problem, and there is no any error message show on the console.
Does anyone know what things happen? and any suggestion for this case if show the console front of end user is not an option.
Many thanks.

Python extension - Debug adapter process has terminated unexpectedly

After installing the Python extension, I find myself not being able to debug. When I select any of the default launch configurations and press the green arrow to start debugging, it notifies me with the error message in the title. I am not using any external modules, I am simply trying to run a single line hello world program and this error still appears. I have tried reinstalling the extension, deleting the .vscode folder and checking the path of my Python interpreter.
I had the same problem, it was gone after I delete c:\users\username\ .code and reinstall vscode. hope that helps.
Lidong

execute to exe. successful by pyinstaller, but the exe. is not work. How can I debug it

It's work on Spyder (Anaconda3) and execute script to exe by pyinstaller without any errors, but nothing happens when I double click exe (also try cx_freeze, but still not work either).
How can I debug it? Appreciate for your help.
import os,shutil
cur_path=os.path.dirname(__file__)
sample_tree=os.walk(cur_path)
for dirname,subdir,files in sample_tree:
allfiles=[]
basename=os.path.basename(dirname)
for file in files:
ext=file.split('.')[-1]
if ext=="csv":#讀取.csv to allfiles
allfiles.append(file)
elif ext=='log':#讀取.log to allfiles
allfiles.append(file)
for file in allfiles:#Copy csv and log of sample_tree to destfolder
destfile = cur_path
srcfile=dirname + "/" + file
shutil.move(srcfile,destfile)
p.s. python 3.6/pyinstaller 3.3/Win 10
Debugging is s simple enough process.
In cx_Freeze you can find any errors by doing the following:
Before building ensure your script works correctly.
When building from a setup script see If any errors or warnings appear while it turns into an application. Do not worry if you get warnings you get these even when the application works correctly just ensure you know about them since they may give you a clue why it is not working.
When you application has been built it run it from command line. This final step will show up any errors.
Next you need to configure you setup script accordingly and recompile it and finally run through the process again to see if you have fixed the problem.
For Pyinstaller follow the same process.
In both modules the best debugging method is to run it from command line.
You can check your application by opening a new terminal window where the application is located and running it
For Linux and CMD (Windows):
yourappname
and for PowerShell:
./yourappname

cx_Freeze: Python error in main script (function not found)

I am trying to create an exe from python script using cx_freeze
I have been able to create the build and test it successfully on win7 but whenever I try to run the exe on win xp I get the following error.
Have tried uninstalling and reinstalling cx_freeze but it wont help.
I am using python 3.4
AttributeError: function 'SetProcessDPIAware' not found
Complete error description
Got the solution.
Build the application on win xp pc.
Add the following lines to your setup file-
os.environ["TCL_LIBRARY"]=r"C:\Python34\tcl\tcl8.6"
os.environ["TCLLIBPATH"]=r"C:\Python34\tcl\tcl8.6"
os.environ["TK_LIBRARY"]=r"C:\Python34\tcl\tk8.6"
All must point to the correct tcl paths within the python setup.
In my case it was looking for tcl in some other location due to some environment variable confusion.
And build your script using cx_freeze again.
Will work like a charm.

Resources