Mac No Python Library Python 2.7 Bin

Mac No Python Library Python 2.7 Bin 5,0/5 2586 reviews
  1. Mac No Python Library Python 2.7 Binding
  2. Python
  3. Mac No Python Library Python 2.7 Bins
  4. Python Download
Download

This chapter describes the current implementation of the Open ScriptingArchitecture (OSA, also commonly referred to as AppleScript) for Python,allowing you to control scriptable applications from your Python program,and with a fairly pythonic interface. Development on this set of modules hasstopped.

  • So what's the plan? I have dozens of Python interpreters on my computer already, and I have no idea how to manage them effectively. I didn't want to download the latest release, move it into my path, and call it a day (or use brew install python3, which would do something similar).I figured it would cause breakages down the line in a really frustrating way that I wouldn't know how to troubleshoot.
  • The Mac-specific modules are documented in Mac OS X specific services. Python on Mac OS 9 or earlier can be quite different from Python on Unix or Windows, but is beyond the scope of this manual, as that platform is no longer supported, starting with Python 2.4.
  • Mac OS X specific services¶. This chapter describes modules that are only available on the Mac OS X platform. See the chapters MacPython OSA Modules and Undocumented Mac OS modules for more modules, and the HOWTO Using Python on a Macintosh for a general introduction to Mac-specific Python.

Mac OS X 10.8 comes with Python 2.7 pre-installed by Apple. If you wish, you are invited to install the most recent version of Python from the Python website (A current “universal binary” build of Python, which runs natively on the Mac’s new Intel and legacy PPC CPU’s, is.

For a description of the various components of AppleScript and OSA, and to getan understanding of the architecture and terminology, you should read Apple’sdocumentation. The “Applescript Language Guide” explains the conceptual modeland the terminology, and documents the standard suite. The “Open ScriptingArchitecture” document explains how to use OSA from an application programmerspoint of view. In the Apple Help Viewer these books are located in the DeveloperDocumentation, Core Technologies section.

As an example of scripting an application, the following piece of AppleScriptwill get the name of the frontmost Finder window and print it:

Mac No Python Library Python 2.7 Binding

In Python, the following code fragment will do the same:

Python

As distributed the Python library includes packages that implement the standardsuites, plus packages that interface to a small number of common applications.

Python

To send AppleEvents to an application you must first create the Python packageinterfacing to the terminology of the application (what Script Editorcalls the “Dictionary”). This can be done from within the PythonIDEor by running the gensuitemodule.py module as a standalone program fromthe command line.

The generated output is a package with a number of modules, one for every suiteused in the program plus an __init__ module to glue it all together. ThePython inheritance graph follows the AppleScript inheritance graph, so if aprogram’s dictionary specifies that it includes support for the Standard Suite,but extends one or two verbs with extra arguments then the output suite willcontain a module Standard_Suite that imports and re-exports everythingfrom StdSuites.Standard_Suite but overrides the methods that have extrafunctionality. The output of gensuitemodule is pretty readable, andcontains the documentation that was in the original AppleScript dictionary inPython docstrings, so reading it is a good source of documentation.

The output package implements a main class with the same name as the packagewhich contains all the AppleScript verbs as methods, with the direct object asthe first argument and all optional parameters as keyword arguments. AppleScriptclasses are also implemented as Python classes, as are comparisons and all theother thingies.

The main Python class implementing the verbs also allows access to theproperties and elements declared in the AppleScript class “application”. In thecurrent release that is as far as the object orientation goes, so in the exampleabove we need to use f.get(f.window(1).name) instead of the more Pythonicf.window(1).name.get().

If an AppleScript identifier is not a Python identifier the name is mangledaccording to a small number of rules:

  • spaces are replaced with underscores

    Jw library for mac. JW Library is an application oriented mainly to the Jehovah’s Witnesses.

  • other non-alphanumeric characters are replaced with _xx_ where xx isthe hexadecimal character value

  • any Python reserved word gets an underscore appended

Python also has support for creating scriptable applications in Python, but Thefollowing modules are relevant to MacPython AppleScript support:

Mac No Python Library Python 2.7 Bins

  • 38.5. MiniAEFrame — Open Scripting Architecture server support

Python Download

In addition, support modules have been pre-generated for Finder,Terminal, Explorer, Netscape, CodeWarrior,SystemEvents and StdSuites. Mac photos library location.