Difference between revisions of "Using Python to Automate MAS"
From MCEWiki
(→Python Scripts) |
(→Getting Started with Python) |
||
| Line 21: | Line 21: | ||
And you must change the permissions of the file to the following: | And you must change the permissions of the file to the following: | ||
chmod a+x <python_script_name> | chmod a+x <python_script_name> | ||
| + | |||
| + | In Emacs, to get high-lighting, type | ||
| + | <alt>+<x> | ||
| + | python-mode | ||
Revision as of 13:44, 29 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>
In Emacs, to get high-lighting, type
<alt>+<x> python-mode