Pyinstaller add icon, launch without console for Mac - python

This is a really short question. I have created a package for Mac using Pyinstaller and I am mainly trying to add an icon to it. I am also trying to get the program to run without launching the terminal as the user has no interaction with the terminal. Currently I am keeing the following into cmd when running pyinstaller:
python pyinstaller.py --icon=group.ico --onefile --noconsole GESL_timetabler.py
I get the regular package (Unix Executable) and an App. However only the Unix Executable works and the no processes run when I double click the App.
Also, neither the App, nor the Unix Executable, has the icon image displayed. I am sure this is a trivial problem with my command to pyinstaller, but I am having difficulty figuring out the mistake. Could someone help me fix the instructions above? Thank you!

You must have group.icns file for app in Mac OS

Try using --windowed instead. As far as I can tell they're the same thing, but it might do the trick.
As for icons, I've only gotten that to work on console windows. It just doesn't carry over to my main GUI window.

Related

reroute terminal to interface of the application

I have built a small desktop application which edits data(.ags format) and then saves to selected folder. Before i had an issue that, i could run it as python file, but it would crash when I make it .exe. I figured out the problem. The reason was that, particular line of code tries to prints to terminal, but .exe did not have it. I deleted sg.output() line from code, then used pyinstaller to make it .exe. Earlier i was using psgcompiler.
Now it works fine. However, when i open software the terminal opens as well (attached photo). Is there any chance to hide it, or add it to software itself? I tried multiline.
I have tried to add, but it did not work.
[sg.Multiline(size=(55, 5), reroute_stdout=True)],
Thanks
By default pyinstaller compiles executables in console mode... which means that unless you tell it otherwise when the application is run outside of the command line, e.g. by double clicking the .exe a console window will always appear.
To avoid this simply use the windowed mode of pyinstaller with the -w flag when compiling.
pyinstaller -w myapp.py

Pyinstaller .exe works from terminal but not by double-clicking -> flashing console window

When I run the .exe from my project folder from terminal with dist\app\app.exe it runs fine, I can see my output in terminal etc.
However, with double-clicking the .exe I just get a flashing terminal window.
Does anyone have an idea or a clue?
By inspiration of the following post: PyInstaller .exe file does nothing I tried using --noupx in my installer command, and this lets me app run by double-clicking while having a terminal window on the background (which I am fine with for now).
When double-clicking you are going to run your application and it will close immediately after completion. The only exception is if the application is going to ask for input. This means that your application most likely runs fine.
It is also possible that you opened cmd-line as Administrator and thanks the application runs fine but when you double-click it is not being executed because it lacks access. It is not possible to tell without a closer investigation though.

How to open a tkinter script that calls a different script within the same directory?

Sorry for the confusing question. I am working on a GUI and backend of a program that takes information from the gmail-api makes it into a text file. The back end and GUI(Tkinter) are working perfectly but through the python3 shell. When I just click on the python script within the directory a black command prompt appears and then disappears.
When I click on a prototype I have of the GUI that does not call another script but a text file, the GUI pops up perfectly.
This is after I used pyinstaller to make it an executable.
My end goal is to make the whole GUI and back end an executable file.
I was wondering if anyone knows why this happens. I think it might be because of it having to call another script...but I am not sure.
Sorry again for the confusing question and wordy explanation.
You want to go to the terminal after you've intalled pyinstaller and run this command:
pyinstaller --onefile --noconsole yourtkinter.py
Explanation:
--onefile : Optional here, more comfortable for tiny tkinter projects.
--noconsole : Will solve your command line opening issue.
Find here more about the pyinstaller package:
https://pyinstaller.readthedocs.io/en/stable/usage.html

Run Python script as an exe without showing a command window

I am a security student first starting out with Python. I've built my first program for my class and it is meant to be an exe so that it may run on any computer without having me install python onto it. The program is meant to go unnoticed by the user, but whenever it is executed a command windows pops up.
Does anyone know how to make a .py into a .exe that when launched would not bring up the command prompt?
I have already tried compiling a .pyw into a .exe and it still pops up the command prompt.
Googling around the py2exe web site, you need to say setup(windows=['myapp.pyw']) instead of setup(console=['myapp.py']). I have problems finding out which page is saying that exactly, but hints are given here for example (search for "console"):
http://www.py2exe.org/index.cgi/FAQ

How to install python 3.2.3 on Windows 7 enterprise

although I have been using python a long time very easily in a Linux environment, I have tremendous trouble to even install it correctly in a windows environment. I hope this is a question to be asked here, as it is not directly a programming question.
Especially, I have the following problems:
When on the command line, python is not a recognized command. Do I have to set the Windows path manually myself? If so, how to do that?
When starting a python script, should this be done with python.exe or pythonw.exe? What is the difference?
I also tried to install ipython several times, it never got installed (even after following the starting ipythonenter link description here thread.
When starting a script with python.exe, a window pops up and closes immediately. I saw some hints in putting in a readline command, which is of no help if there is a syntax error in the script. So how to be able to keep the window open, or how to run the command on the cmd.exe?
Thank you for any help on these items.
Alex
1) Look here: www.computerhope.com/issues/ch000549.htm
2) It has already been answered, always try to use search before asking question:
pythonw.exe or python.exe?
4) When using cmd.exe just navigate to your script folder using dir for changing directories and C:,D:,etc. for changing drives. Then run script by typing just the script name. When installed correctly, Python automatically launches .py scripts with python, so you don't have to write 'python' before script name. When run in cmd, window will stay open. If you want it to stay open even when launching script with double-click, use function waiting for user input, see here How to keep a Python script output window open?
You might want to use Python3.3, there is a new launcher for Python scripts in it. By that, you can start Python scripts with py <scriptname> which has the benefit of being installed in your path (C:\Windows\system32) and you can use a shebang to tell whether the script is for Python2 or Python3.
Also
In addition to the launcher, the Windows installer now includes an
option to add the newly installed Python to the system PATH
(contributed by Brian Curtin in issue 3561).

Categories