Use Applescript to Launch Python
Let's be 100% clear about what I am not trying to do. I am not trying to run a python script or start a python process in terminal with Applescript. Instead I am running a Python script which launches an easygui message box. This easygui messagebox then launches some weird Python application. I am trying to find out what that application and set it to frontmost. I run the following Python code:
from easygui import *
b = enterbox("what time then?")
which opens an easygui entrybox like so:
If you look at that fountain pen it says Python. That has to launch in order for that messagebox to pop up. If I could figure out how to tell applescript to find that app, I could then bring the entrybox to the front, but I cannot now. When you look up top at what the name of the app is you will see:
When you click on Python and get the information, you find:
I cannot find the path that launches that application. I have found the path of the Python Launcher and I can open it with applescript using:
os.system(f'''/usr/bin/osascript -e 'tell application "Python Launcher" to activate' ''')
The Python launcher is located in my apps folder and you would think that there is where Python is located but it is not:
The other areas that have Python file will launch the Python process in terminal so they're not helpful.
This is the applescript code I'm using that will set Python to the front if it is open
os.system(f'''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python" to true' ''')
MacBook Pro, OS X Yosemite (10.10.1)