I have a Python application built under PyInstaller on a MAC. I do not want to have a terminal window when it is running so I specified the --noconsole option. Apparently, under MACos, this option still provides a console (terminal) window if you use the EXE file. If you use the MAC application package to start, then you do not have the console/terminal window.
The problem is that the program reads a data file at initialization. When I run the EXE, that data file is in the same directory as the EXE and it loads fine. But when it runs as an app, it reads from the default working directory and I have no idea where that is. So it can't find the data file required. And reading further it seems from MAC OS to OS the working directory location might change. I moved the data file where the EXE is in the MAC application, but when Python reads that is not the directory it is reading from.
So how can I place the required data file somewhere the Python application (not running the EXE directly) will find it.
Under Windows, the data file is just in the same directory where the EXE is running and there is no console window. There is no concept of the MAC application type. But if I don't want to have the Terminal window, I need to resolve where to place a data file so that will be found.
I suggest digesting some of these basic Apple macOS developer documents. All your answers will come through understanding these.
Bundles
Codesigning
Information Property List
Entitlements
Embedding Non-standard Code Structures
Related
I would like to create an executable file from my python project that consists of one python file that uses gecodriver.exe, I have tried using pyinstaller for this matter, however the program closes as soon as it opens, basically it doesn't work. I suspect that the .exe file that is created by pyinstaller does not include or cannot see geckodriver. Any sugestions how to make it work will be helpful.
I need to make executable file on OSX/Mac. I have python3 script that uses excel file. Executable file also should be able to work just by double clicking the icon and also have python packages. I mainly work with Ubuntu18 but have access to Mac for few days.
What I've tried so far:
I've written a short bash script that activates python environment (with "source activate" command) and runs python script. Appified the script with this: https://gist.github.com/anmoljagetia/d37da67b9d408b35ac753ce51e420132
I know that terminal commands work but double-clicking the app in Mac does nothing.
With pyinstaller converted bash+python script to exe, then with wine tried converting that to executable program but that double-clicked program does nothing.
Tried py2app, but in the mac terminal it says "cannot execute binary file".
Does someone have any recommendations for my problem? As I've mentioned there are few main requirements:
works by double-clicking
works on mac
has all python packages
is able to read specific excel file (I will know the name of it, but just path may be confusing in some versions, because I would like to use relative path or something like [pwd]/file.xlsx)
Anyway, I'm having most problems with the first two points but don't want to forget the last two.
Thank You for help!
I am trying to run my python(3) web service using IIS 8 following the instruction provided here
Everything is fine to the point where I try to add "FastCgi Module" in "Add Module Mapping" section. The problem is when I click on OK on "Add Module Mapping" window, the error pops up:
The specified executable for the handler must be .dll or .exe file. If the path to the script processor (only in the case of a .exe file) has spaces, use " marks to specify the executable.
I suppose there has to be a FastCgi.dll?
Is there a better way to achieve that?
P.S: I have read an ample of instructions regarding running python 2.6 web services on IIS using ISAPI_WSGI Handler and there are warnings regarding using it on later python versions, I wonder if that instructions hold up using python 3.3.6.
When you add Executable setting, it must be an executable, this means that is has to be either .exe or .dll. If you look at the picture in the instructions, you will see an executable there (python.exe).
If you don't provide path to an executable, error that specified executable must be .dll or .exe will pop up. Make sure you are referring to an executable there and it should be fine then.
I can not launch a python script from a .desktop launcher created on Linux Mint 17.1 Cinnamon.
The problem is that the script will be launched in the wrong path - namely the home folder instead of the directory it is placed in. Thereby it can not find other vital files accompanying it in its folder and hence does not work.
To examine that misbehaviour I created a short script to check the folder a python script is executing in:
#!/usr/bin/env python
import subprocess
import time
subprocess.call(["pwd"], shell=True)
time.sleep(7) # to get a chance to read the output
Executing it from its own folder gives the output:
/home/myusername/PythonProjects
I am setting a desktop launcher via Nemo's menu. Now executing the same script yields:
/home/myusername
I do not understand this behaviour. How could I create a working desktop launcher for my python script?
The page describes the format of .desktop files.
You may note the "Path" element, which specifies the working directory for the file to be run in. In your case you would want a desktop file that specified
Path=/home/myusername/PythonProjects
If Nemo doesn't allow you to set the Path element you may need to edit the desktop file by hand. The .desktop files are text files and you can probably find them in /home/myusername/.local/share/applications/
I have developed my first .app for mac, written in python and would like to share this .app with some friends.
I have converted the python scripts via py2app. Then I have one .app and compress it to an .dmg file.
I share this .dmg file with the guys and for one, this is working fine. (He has already python installed)
The other people canĀ“t open the .app file, they get error messages. After an intensive search I got it. They have no python installed.
Now my question: How can I include a "one click python installation" in my .dmg file (or as package?!)
If you create the .dmg, you can setup a background image that tells users to move your application to the /Applications folder. If your application needs no extra setup, this is preferred, or a (Mac OS X created) .zip file with it.
The package option is better if some additional setup, or scripts checking for Python dependencies, are required.