When I run an EXE file which was created by py2exe, everything is running fine, but when I close the window, it gives the following error:
memory cannot be written
What is going wrong? Whatever I do,the cue is still received. But when I run the .py file directly, everything is running ok.
Related
I work in small company, wrote small program to help people get data more comftorbale out of database in python. Used pyinstaller to create exe file. It worked. Almost. If exe file sits in dist folder it works but if I want to share with everyone else in company it doesn't. It just closes window immediately. How could I share that exe file with everybody that they could use it?
EDIT:
Found a solution. I haven't used: "--onefile' while creating that exe file. Now it works.
The instantly closing window (which I assume is a Console window of some sort) is likely caused by your application crashing.
You could call your .exe Python program via a Batch file like the following to get a better view of the thrown error message.
C:\foo\bar\yourProgramFromPyInstaller.exe
pause
Save the above as a *.bat file and execute it. Now, the console window should stay open until you close it.
When you got the error message, we can help you better.
I have a big python project which I'm currently developing, and I want to make a .exe file that launches the main.py file. I have a file called ultimate_launcher.py which has the following code:
exec(open("main.py").read())
That is a solution I found somewhere on Stack Overflow. it runs fine as a .py file, but when I use pyinstaller to convert it to a .exe, it has a "Fatal" error,
Failed to execute script ultimate_launcher
I don't want the rest of my project to be put into the .exe as I am still in the process of development.
So my question is how do I make a .exe that ONLY references the file main.py so when it gets updated, i don't have to remake the .exe file.
I believe there is a method to achieve this detailed in this thread:
Python - create an EXE that runs code as written, not as it was when compiled
EDIT:
This works
import subprocess
f = open("c:\\temp\\temp.py", "w")
f.write(open("main.py").read())
f.close()
subprocess.call("\"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python37_64\\Scripts\\pyinstaller.exe\" --distpath \"c:\\temp\" c:\\temp\\temp.py " )
subprocess.call("C:\\temp\\temp\\temp.exe")
I'm on day two of a desperate attempt to run a Windows executable from a Python script. This .exe file is opaque to me; in other words, I don't know how to open it up to look at the source code. But importantly, this executable needs to be located in the same directory as a csv file full of parameters in order to work.
When I call the file directly in the command line:
C:\Users\pb\nw_river> Run_Model.exe
the executable works exactly as expected.
However, when I try to call the same file from some python code:
import subprocess
subprocess.Popen(["C:\Users\pb\nw_river\Run_Model.exe"], shell=True)
I receive error messages that indicate that the executable can't "see" the required csv file.
I don't have any of these problems when I run the script on my macbook (MacOS Catalina 10.15.3), but I really need to get this to run on my work computer, which has a Windows 10 Pro OS.
I'm a total noob to Windows. Has anyone ever experienced this issue, and do you have any advice? Thanks in advance!
I have python exe file which has been made using cx_Freeze. Basically The script uses the text file "XYZ.txt" to generate a word cloud. When I run the python exe file everything is fine and the code runs well, but I am planning to run it from an external program (a game which generates the text file) and when I'm trying to run it from that game, python exe runs but gives me the FileNotFoundError: [Error 2] No such file or directory: 'XYZ.txt'. But the 'XYZ.txt' actually is in the same folder and at the same time. Besides, I tried to run the text file from that game and it opened but the python exe cannot find it.
I have also tried to run my game as administrator and then running the python exe and then I got: "dll load failed the specified module could not be found" instead of the previous error.
I would be thankful if anyone could help me with that.
please give the absolute path for 'XYZ.txt' in your python code. I guess that might solve the problem.
I just finished creating a python program in 2.7 and I converted it to a .exe with py2exe.
Everything works fine when I run the converted executable file in the folder I placed it in with all of the images in it. After converting the python program to .exe, I proceeded to creating a setup file for it. I added all of the files associated with my project including tkinter in the setup file. I added pretty much everything that let me run the executable.
Once I finished creating the setup file, I opened it. I went through everything and finished installing it on my system and created a shortcut on my Desktop. When I tried to open it, it would not work. Instead of running the program, it tells me to open a log file in its folder in the Program Files. When I open the log file, I noticed an error. How do I fix this?
Error:
Traceback (most recent call last):
File "gui.py", line 10, in <module>
File "Tkinter.pyc", line 1764, in __init__
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
{C:/Program Files (x86)/lib/tcl8.5} {C:/Program Files (x86)/lib/tcl8.5} C:/lib/tcl8.5 {C:/Program Files (x86)/library} C:/library C:/tcl8.5.15/library C:/tcl8.5.15/library
This probably means that Tcl wasn't installed properly.
I found a bug on the virutalenv site which suggested the following https://github.com/pypa/virtualenv/issues/93
I imagine that you are encountering the same issue just without virtualenv
the following set the correct paths which can then be included in the application please find the right path to TCL and TK for your python version
set "TCL_LIBRARY=C:\Python27\tcl\tcl8.5"
set "TK_LIBRARY=C:\Python27\tcl\tk8.5"
restart your cmd or shell
I believe that the TCL location have changed from there default ones.