Difference between revisions of "Using Python to Automate MAS"
From MCEWiki
(→Python Scripts) |
|||
| Line 1: | Line 1: | ||
| − | == Python | + | == Getting Started with Python == |
To install the Emacs template file for python, type the following: | To install the Emacs template file for python, type the following: | ||
sudo apt-get install python-mode | sudo apt-get install python-mode | ||
Revision as of 16:44, 28 July 2008
Getting Started with Python
To install the Emacs template file for python, type the following:
sudo apt-get install python-mode
Here is a sample starter script for the MCE:
mce@mce-ubc-2:~$ python
Python 2.4.3 (#2, Mar 7 2008, 01:58:20)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.system('mce_cmd -x rb cc fw_rev')
This is mce_cmd version MAS/trunk/230
Line 0 : ok : 0x400000b
Processed 0 lines, exiting.
0
>>>
When creating a python script, for the script to be executable, you must put the following line of code at the top:
#!/bin/python
And you must change the permissions of the file to the following:
chmod a+x <python_script_name>