To fix this, I added a simple AppleScript to the same (scripts) directory. I've included this at the bottom, if it helps. So the AppleScript runs first, then it calls "do shell script" to run the Python program. My problem is that the script can't call any GUI functions, such as the following:
import osaxsa = osax.OSAX() # allows use of standard additions (like display dialog)
sa.display_dialog("Hi world")If I run from the command line, the dialog shows up fine. If I run from within Word or BibDesk, the dialog doesn't show up at all. I think it is because "do shell script" runs it in an invisible shell that can't access the main GUI. So the dialog comes up, but is not visible to the user. The calling application (Word or BibDesk) freezes since the dialog is "up" but can't be responded to by the user.
Is there a better way to do this? How can I run Python scripts from the Scripts menu in a program?
Thanks in advance. ================================= -- Get this script's directory and name tell application "Finder" to (path to me) as Unicode text set scriptname to POSIX path of result -- Remove the .scpt extension, and append .py instead set AppleScript's text item delimiters to {".scpt"} set textItems to text items of scriptname set AppleScript's text item delimiters to {""} set scriptname to textItems as string set scriptname to scriptname & ".py" -- Run the script do shell script "python '" & scriptname & "'" =================================== ____________________________________ Conan C. Albrecht, Ph.D. Information Systems Department Brigham Young University Email: co...@warp.byu.edu Phone: +1-801-805-1615 Web/Blog: http://warp.byu.edu/
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig