I am trying to compile a python program to an executable application on Mac OS X (Catalina) using py2app, and just cannot get it to work at all, would greatly appreciate if anybody can point out what I'm doing wrong. For the purposes of debugging my py2app problems, I have simplfied my python program down to:
d = 0.1
print ("starting")
for a in range (100000000):
d = d + 0.1
print ("finishing")
which is meant to print "starting" to the console, run for a while (about 10s on my Mac), and then print ("finishing") and terminate. When I run the program from the command line it works fine. When I compile using py2app and then try to run the final compiled app, I am not getting it to do anything, no pulse, no signs of life - it just looks as if it's opening, and then nothing. (I have similar lack of luck when I replace the print statements with file writes)
To compile my program I am using what I found on the main py2app docs:
rm -rf build dist
py2applet --make-setup test_py2app.py
python3 setup.py py2app -A
after which py2app seems to finish normally without any error messages. As described above, though, when I double click the resulting application icon, it seems to open but nothing happens.
If it helps, when I open the Console window and search for all messages mentioning my app ("test_py2app") I get the following logs:
(which includes the ominous sounding "Death sentinel fired!" message a few messages up from the bottom. Note: all of this occurs with 0.2 seconds, far quicker than my app should take to run and terminate).
Thanks in advance.
Related
I'm working on a VirtualBox Machine running Ubuntu 20.04 as the software. I'm using the virtual machine to create executable scripts using pyinstaller that will work across several platform types.
What Happens
Using the terminal, I run python3 -m PyInstaller --onefile "filename.py", which works as it should and creates a single file of the program. However, the name of the program is just that, the name. There is no file type associated with it and the end is just blank. For example, if the program name is program v.1.0.py, the executable's name is program v.1.0. Once I click on it, it will not run and nothing will show up. The log file I have set up shows the error CRITICAL: Program experienced unexpected error. Program terminated with EOF when reading a line. From my research, I understand this can happen when there is an input clause that is not fulfilled, which makes sense as the first line of the code begins with an input line.
What Should Happen
The executable should pop up a terminal dialogue as it does on my Debian and Windows devices, but instead, I get nothing, not even an indication of something going wrong. If anyone has experience with something similar and an idea of how to fix it, I would appreciate the help.
I tried to execute a try except command on the app to get log of the error but it still crash so I think it is a problem of PATH ? library ?
Why does it work with pyinstaller and not after I created an installer.nsi with HM NSIS edit ?
I'm sorry but I have no idea of how to debug it !
It is a "simple" project. tkinter app, excel creation, 1 thread...
I don't know from where it comes from (I'm not good in system and OS).
PS: even stranger, when I install the app with Install.exe, if I decide to launch the app directly it works !!!
But it never work a second time when I use the shortcut or the .exe in C:\Program Files (x86)\MYDIRECTORY.
This a permission problem, I tried to write on a protected file.
Solution to debug:
do not use --noconsole when you run pyinstaller, it will let you the console and with windows+G, you can keep track of the error even if the terminal stop immediatly after the crash of the programm.
(I tried to register the error in a .json in a try except but that the thing that made my program crash !)
I'm trying to run a python script on my raspberrypi using cron.
I did the following:
crontab -e # To edit a crontab job
After the cron file opened, I added the following line:
#reboot /usr/bin/python /home/pi/path/to/file/example.py > /home/pi/cronlogs/mylog.log # JOB_ID_!
If I understand the documentation correctly, this cron job should be executed every time after the system booted up. However in my case, when I reboot the computer, the script will not be executed.
What's strange:
I checked the log file and it's empty, so it seems like everything goes fine
If I run the given command manually (so basically write the following code to the terminal) it executes and works correctly: /usr/bin/python /home/pi/path/to/file/example.py > /home/pi/cronlogs/mylog.log
I guess I missed something really obvious but I can't see it. Please can I ask for any advise how to debug this. Thanks!
The cron definition looks correct; I just checked this on my Pi running Debian stretch and it works OK:
#reboot /usr/bin/python /home/pi/example.py > /home/pi/mylog.log
Some other possible reasons it might not work:
working directory issue (if you're using relative paths)
a long running script (being a scraping script it might take a while to complete) - you can check if it's still running using ps aux | grep python
the script does not output anything (would need some more details about the script)
Just to be sure you catch any errors from the script, redirect stderr to stdout by using 2>&1
I use a RaspberryPi 3 with UbuntuMate 16.04. On it, I want to start a little Python (3.5) program every midnight. For that I call a little shell script, so that I can change into the wanted directory comfortably.
crontab:
5 0 * * * /path/to/script/start.sh
start.sh (yes, it's executable):
#!/bin/bash
cd /path/to/wanted/workingDir/
python3.5 ControllerQueue.py
#also tried: python3.5 ControllerQueue.py &
Now if I execute the programm or script from the terminal, everything runs fine. But if I use the crontab it starts the script and stops right after. I also tried running the programm directly but get the same outcome. The paths are correct as I copied the workingDir path from the crontab-file and started it via the terminal.
Is there something I overlook?
As stofvl suggested, I saved the error output of my shell script. It turns out that I needed to add a display. My programm is divided into two scripts. One which provides a GUI and the other main application. The script only starts the main application, without the GUI, but it seems that this didn't matter.
This discussion helped me solve the problem.
I've been using the ete2 module on very powerful servers for some time.
Everything was fine until it started going very slowly (one get_taxid_translator() function per minute), now I cannot even get past ncbi = NCBITaxa() assignment.
I have uninstalled and reinstalled anaconda2, tried updating to ete3, everything works fine on our 'development servers' but still cannot get past the ncbi = NCBITaxa() line in any piece of software on our normal servers. Even the following script fails to finish
#!/usr/bin/env python
from ete3 import NCBITaxa
ncbi = NCBITaxa()
print "Finished"
Has this happened to anyone else? Do I need to downgrade any dependencies? Could it be a permissions issue?
When I run the basic script ctrl+c nor ctrl+z will escape the script and I have to use kill -9 <job-id> to kill the script. If I wait too long the process enters an uninterruptible sleep.
Thank you in advance,
Alexis.
Python 2.7.12 :: Anaconda custom (64-bit)
gcc (GCC) 5.4.0