<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FBobbySaunders</id>
	<title>GRASS-Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FBobbySaunders"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/wiki/Special:Contributions/%E2%9A%A0%EF%B8%8FBobbySaunders"/>
	<updated>2026-05-25T14:37:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Python&amp;diff=16471</id>
		<title>GRASS and Python</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Python&amp;diff=16471"/>
		<updated>2012-09-21T05:30:23Z</updated>

		<summary type="html">&lt;p&gt;⚠️BobbySaunders: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Python SIGs==&lt;br /&gt;
Python Special Interest Groups are focused collaborative efforts to develop, improve, or maintain specific Python resources. Each SIG has a charter, a coordinator, a mailing list, and a directory on the Python website. SIG membership is informal, defined by subscription to the SIG's mailing list. Anyone can join a SIG, and participate in the development discussions via the SIG's mailing list. Below is the list of currently active Python SIGs, with links to their resources. &lt;br /&gt;
&lt;br /&gt;
See more at http://www.python.org/community/sigs/&lt;br /&gt;
&lt;br /&gt;
==Writing Python scripts in GRASS==&lt;br /&gt;
&lt;br /&gt;
Python is a programming language which is more powerful than shell scripting but easier and more forgiving than C.&lt;br /&gt;
The Python script can contain simple module description definitions which will be processed with {{cmd|g.parser}}, as shown in the example below. In this way with no extra coding a GUI can be built, inputs checked, and a skeleton help page can be generated automatically. In addition it adds links to the GRASS message translation system. The library for &amp;quot;scripting&amp;quot; is &amp;quot;grass.script&amp;quot;, typically used as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import grass.script as grass&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The related files are at $GISBASE/etc/python/grass/script/*.py. See below for more details.&lt;br /&gt;
&lt;br /&gt;
''Note: For code which needs access to the power of C, you can access the GRASS C library functions via [[GRASS and Python#Python Ctypes Interface|the Python &amp;quot;ctypes&amp;quot; interface]].''&lt;br /&gt;
&lt;br /&gt;
=== Python script editor ===&lt;br /&gt;
&lt;br /&gt;
The [[wxGUI]] Layer Manager in GRASS 6.4.3+ comes with a &amp;quot;Python shell&amp;quot; which enables users to type and execute python commands directly in wxGUI environment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wxgui-pyshell.png|center|350px|Embedded interactive Python Shell in wxGUI Layer Manager]]&lt;br /&gt;
&lt;br /&gt;
=== Using the GRASS Python Scripting Library ===&lt;br /&gt;
&lt;br /&gt;
You can run Python scripts easily in a GRASS session.&lt;br /&gt;
&lt;br /&gt;
To write these scripts, &lt;br /&gt;
* check the code in lib/python/ which provides grass.script in order to support GRASS scripts written in Python.&amp;lt;br&amp;gt;&lt;br /&gt;
  See the [[GRASS Python Scripting Library]] for notes and examples.&lt;br /&gt;
* The scripts/ directory of GRASS contains a series of examples actually provided to the end users.&lt;br /&gt;
&lt;br /&gt;
For the desired Python code style, have a look at {{src|SUBMITTING_PYTHON}}.&lt;br /&gt;
&lt;br /&gt;
=== Creating Python scripts that call GRASS functionality from outside ===&lt;br /&gt;
&lt;br /&gt;
Note: This is a more advanced use case of using GRASS' functionality from outside via Python. Commonly, a user will run GRASS Python script from inside a GRASS session, i.e. either from the command line or from the Python shell embedded in the wxGUI ([[:File:Wxgui-pyshell.png|screenshot]]).&lt;br /&gt;
&lt;br /&gt;
For calling GRASS functionality from outside, see also [[Working with GRASS without starting it explicitly]].&lt;br /&gt;
&lt;br /&gt;
==== MS-Windows ====&lt;br /&gt;
&lt;br /&gt;
In order to use GRASS functionality via Python from outside, some environment variables have to be set:&lt;br /&gt;
&lt;br /&gt;
 GISBASE= C:\GRASS-64&lt;br /&gt;
 GISRC= C:\Documents and Settings\user\.grassrc6&lt;br /&gt;
 LD_LIBRARY_PATH= C:\GRASS-64\lib&lt;br /&gt;
 PATH= C:\GRASS-64\etc;C:\GRASS-64\etc\python;C:\GRASS-64\lib;C:\GRASS-64\bin;C:\GRASS-64\extralib;C:\GRASS-64\msys\bin;C:\Python26;&lt;br /&gt;
 PYTHONLIB= C:\Python26&lt;br /&gt;
 PYTHONPATH= C:\GRASS-64\etc\python&lt;br /&gt;
 GRASS_SH= C:\GRASS-64\msys\bin\sh.exe&lt;br /&gt;
&lt;br /&gt;
At the super casino that plays are tested by TST this is an independent tester of software and the transactions are theft-proof as the casino is managed by 128-bit SSL encryption. If you further have any question or complaints you can seek he assistance of polite and helpful support team to answer, your queries, questions you can contact the support team 24/7. Moreover the [http://supercasino-games.co.uk/ super casino game] is commitment to responsible gaming that will help the gamblers stay within limits.&lt;br /&gt;
&lt;br /&gt;
Some hints:&lt;br /&gt;
&lt;br /&gt;
# The Python interpreter (python.exe) needs to be in the PATH&lt;br /&gt;
# Python needs to be associated with the .py extension&lt;br /&gt;
# PATHEXT needs to include .py if you want to be able to omit the extension&lt;br /&gt;
# PYTHONPATH needs to be set to %GISBASE%\etc\python&lt;br /&gt;
&lt;br /&gt;
1-3 should be taken care of by the Python installer. 4 needs to be done by the startup (currently, this doesn't appear to be the case on MS-Windows).&lt;br /&gt;
&lt;br /&gt;
==== Linux ====&lt;br /&gt;
&lt;br /&gt;
In order to use GRASS functionality via Python from outside, some environment variables have to be set:&lt;br /&gt;
&lt;br /&gt;
 export GISBASE=&amp;quot;/usr/local/grass-6.4.svn/&amp;quot;&lt;br /&gt;
 export PATH=&amp;quot;$PATH:$GISBASE/bin:$GISBASE/scripts&amp;quot;&lt;br /&gt;
 export LD_LIBRARY_PATH=&amp;quot;$LD_LIBRARY_PATH:$GISBASE/lib&amp;quot;&lt;br /&gt;
 # for parallel session management, we use process ID (PID) as lock file number:&lt;br /&gt;
 export GIS_LOCK=$$&lt;br /&gt;
 # path to GRASS settings file&lt;br /&gt;
 export GISRC=&amp;quot;$HOME/.grassrc6&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Running external commands from Python ===&lt;br /&gt;
For information on running external commands from Python, see:&lt;br /&gt;
http://docs.python.org/lib/module-subprocess.html&lt;br /&gt;
&lt;br /&gt;
Avoid using the older os.* functions. Section 17.1.3 lists equivalents&lt;br /&gt;
using the Popen() interface, which is more robust (particularly on&lt;br /&gt;
Windows).&lt;br /&gt;
&lt;br /&gt;
=== Testing and installing Python extensions ===&lt;br /&gt;
&lt;br /&gt;
==== Debugging ====&lt;br /&gt;
&lt;br /&gt;
Make sure the script is executable:&lt;br /&gt;
&lt;br /&gt;
    chmod +x /path/to/my.extension.py&lt;br /&gt;
&lt;br /&gt;
During development, a Python script can be debugged using the Python Debugger (pdb):&lt;br /&gt;
&lt;br /&gt;
    python -m pdb /path/to/my.extension.py input=my_input_layer output=my_output_layer option=value -f&lt;br /&gt;
&lt;br /&gt;
==== Installation ====&lt;br /&gt;
&lt;br /&gt;
Once you're happy with your script, you can put it in the scripts/ folder of your GRASS install. To do so, first create a directory named after your extension, then create a Makefile for it, and a HTML man page:&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/grass_src/&lt;br /&gt;
    cd scripts&lt;br /&gt;
    ls # It is useful to check out the existing scripts and their structure&lt;br /&gt;
    mkdir my.extension&lt;br /&gt;
    cd my.extension&lt;br /&gt;
    cp path/to/my.extension.py .&lt;br /&gt;
    touch my.extension.html&lt;br /&gt;
    touch Makefile&lt;br /&gt;
&lt;br /&gt;
Next step is to edit the Makefile. It is a very simple text file, the only thing to check is to put the right extension name (WITHOUT the .py file extension) after PGM:&lt;br /&gt;
&lt;br /&gt;
    MODULE_TOPDIR = ../..&lt;br /&gt;
    &lt;br /&gt;
    PGM = my.extension&lt;br /&gt;
    &lt;br /&gt;
    include $(MODULE_TOPDIR)/include/Make/Script.make&lt;br /&gt;
    &lt;br /&gt;
    default: script&lt;br /&gt;
&lt;br /&gt;
The HTML file would be generated automatically. If you want to add more precisions in it, you can do it (just make sure you start at DESCRIPTION. See existing scripts.)&lt;br /&gt;
&lt;br /&gt;
You can then run &amp;quot;make&amp;quot; within the my.extension folder. Running &amp;quot;make&amp;quot; in the extension directory places the resulting files in the staging directory (path/to/grass_src/dist.&amp;lt;YOUR_ARCH&amp;gt;/). If you're running GRASS from the staging directory (/path/to/grass_src/bin.&amp;lt;YOUR_ARCH&amp;gt;/grass7), subsequent commands will used the updated files. &lt;br /&gt;
&lt;br /&gt;
    # in your extension directory (/path/to/grass_src/scripts/my.extension/)&lt;br /&gt;
    make&lt;br /&gt;
    # Starting GRASS from the staging directory&lt;br /&gt;
    /path/to/grass_src/bin.&amp;lt;YOUR_ARCH&amp;gt;/grass7&lt;br /&gt;
    my.extension help&lt;br /&gt;
&lt;br /&gt;
You can also run &amp;quot;make install&amp;quot; from the top level directory of your GRASS install (say /usr/local/src/grass_trunk/). Running &amp;quot;make install&amp;quot; from the top level just copies the whole of the dist.&amp;lt;YOUR_ARCH&amp;gt;/ directory to the installation directory (e.g. /usr/local/grass70) and the bin.&amp;lt;YOUR_ARCH&amp;gt;/grass70 bin file to the bin directory (e.g. /usr/local/bin), and fixes any embedded paths in scripts and configuration files.&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/grass_src&lt;br /&gt;
    make install&lt;br /&gt;
    # Starting GRASS as usual would work and show your extension available&lt;br /&gt;
    grass7&lt;br /&gt;
    my.extension help&lt;br /&gt;
&lt;br /&gt;
==Python extensions in GRASS GIS==&lt;br /&gt;
&lt;br /&gt;
=== Python Scripting Library ===&lt;br /&gt;
&lt;br /&gt;
* See [[GRASS Python Scripting Library]]&lt;br /&gt;
&lt;br /&gt;
=== Python Ctypes Interface ===&lt;br /&gt;
&lt;br /&gt;
This interface allows calling GRASS library functions from Python scripts. See [[Python Ctypes Examples]] for details.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
* GRASS 7: [http://trac.osgeo.org/grass/browser/grass/trunk/doc/python/raster_example_ctypes.py raster], [http://trac.osgeo.org/grass/browser/grass/trunk/doc/python/vector_example_ctypes.py vector] example&lt;br /&gt;
&lt;br /&gt;
* Latest and greatest: GRASS 7 Python {{src|scripts}}&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strike&amp;gt;[[PythonSwigExamples|More complicated examples]]&amp;lt;/strike&amp;gt; &amp;lt;&amp;lt;-- TODO: update to Ctypes&lt;br /&gt;
&lt;br /&gt;
Sample script for GRASS 6 raster access (use within GRASS, Spearfish session):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
&lt;br /&gt;
## TODO: update example to Ctypes&lt;br /&gt;
&lt;br /&gt;
import os, sys&lt;br /&gt;
from grass.lib import grass&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;GISBASE&amp;quot; not in os.environ:&lt;br /&gt;
    print &amp;quot;You must be in GRASS GIS to run this program.&amp;quot;&lt;br /&gt;
    sys.exit(1)&lt;br /&gt;
&lt;br /&gt;
if len(sys.argv)==2:&lt;br /&gt;
  input = sys.argv[1]&lt;br /&gt;
else:&lt;br /&gt;
  input = raw_input(&amp;quot;Raster Map Name? &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
grass.G_gisinit('')&lt;br /&gt;
&lt;br /&gt;
# find map in search path&lt;br /&gt;
mapset = grass.G_find_cell2(input, '')&lt;br /&gt;
&lt;br /&gt;
# determine the inputmap type (CELL/FCELL/DCELL) */&lt;br /&gt;
data_type = grass.G_raster_map_type(input, mapset)&lt;br /&gt;
&lt;br /&gt;
infd = grass.G_open_cell_old(input, mapset)&lt;br /&gt;
inrast = grass.G_allocate_raster_buf(data_type)&lt;br /&gt;
&lt;br /&gt;
rown = 0&lt;br /&gt;
while True:&lt;br /&gt;
    myrow = grass.G_get_raster_row(infd, inrast, rown, data_type)&lt;br /&gt;
    print rown, myrow[0:10]&lt;br /&gt;
    rown += 1&lt;br /&gt;
    if rown == 476:&lt;br /&gt;
        break&lt;br /&gt;
&lt;br /&gt;
grass.G_close_cell(inrast)&lt;br /&gt;
grass.G_free(cell)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample script for vector access (use within GRASS, Spearfish session):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
# run within GRASS Spearfish session&lt;br /&gt;
# run this before starting python to append module search path:&lt;br /&gt;
#   export PYTHONPATH=/usr/src/grass70/swig/python&lt;br /&gt;
#   check with &amp;quot;import sys; sys.path&amp;quot;&lt;br /&gt;
# or:&lt;br /&gt;
#   sys.path.append(&amp;quot;/usr/src/grass70/swig/python&amp;quot;)&lt;br /&gt;
# FIXME: install the grass bindings in $GISBASE/lib/ ?&lt;br /&gt;
&lt;br /&gt;
import os, sys&lt;br /&gt;
from grass.lib import grass&lt;br /&gt;
from grass.lib import vector as grassvect&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;GISBASE&amp;quot; not in os.environ:&lt;br /&gt;
    print &amp;quot;You must be in GRASS GIS to run this program.&amp;quot;&lt;br /&gt;
    sys.exit(1)&lt;br /&gt;
&lt;br /&gt;
if len(sys.argv)==2:&lt;br /&gt;
  input = sys.argv[1]&lt;br /&gt;
else:&lt;br /&gt;
  input = raw_input(&amp;quot;Vector Map Name? &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
grass.G_gisinit('')&lt;br /&gt;
&lt;br /&gt;
# find map in search path&lt;br /&gt;
mapset = grass.G_find_vector2(input,'')&lt;br /&gt;
&lt;br /&gt;
# define map structure&lt;br /&gt;
map = grassvect.Map_info()&lt;br /&gt;
&lt;br /&gt;
# define open level (level 2: topology)&lt;br /&gt;
grassvect.Vect_set_open_level (2)&lt;br /&gt;
&lt;br /&gt;
# open existing map&lt;br /&gt;
grassvect.Vect_open_old(map, input, mapset)&lt;br /&gt;
&lt;br /&gt;
# query&lt;br /&gt;
print 'Vect map: ', input&lt;br /&gt;
print 'Vect is 3D: ', grassvect.Vect_is_3d (map)&lt;br /&gt;
print 'Vect DB links: ', grassvect.Vect_get_num_dblinks(map)&lt;br /&gt;
print 'Map Scale:  1:', grassvect.Vect_get_scale(map)&lt;br /&gt;
print 'Number of areas:', grassvect.Vect_get_num_areas(map)&lt;br /&gt;
&lt;br /&gt;
# close map&lt;br /&gt;
grassvect.Vect_close(map)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== wxPython GUI development ===&lt;br /&gt;
&lt;br /&gt;
* See the [[wxGUI]] wiki page&lt;br /&gt;
&lt;br /&gt;
=== Python-GRASS add-ons ===&lt;br /&gt;
&lt;br /&gt;
Stand-alone addons:&lt;br /&gt;
&lt;br /&gt;
* Jáchym Čepický's PyWPS, GRASS-Web Processing Service (http://pywps.wald.intevation.org)&lt;br /&gt;
&lt;br /&gt;
=== Using GRASS gui.tcl in Python ===&lt;br /&gt;
&lt;br /&gt;
Here is some example code to use the grass automatically generated guis in python code. This could (should) all be bundled up and abstracted away so that the implementation can be replaced later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import Tkinter&lt;br /&gt;
import os&lt;br /&gt;
&lt;br /&gt;
# Startup (once):&lt;br /&gt;
&lt;br /&gt;
tk = Tkinter.Tk()&lt;br /&gt;
tk.eval (&amp;quot;wm withdraw .&amp;quot;)&lt;br /&gt;
tk.eval (&amp;quot;source $env(GISBASE)/etc/gui.tcl&amp;quot;)&lt;br /&gt;
# Here you could do various things to change what the gui does&lt;br /&gt;
# See gui.tcl and README.GUI&lt;br /&gt;
&lt;br /&gt;
# Make a gui (per dialog)&lt;br /&gt;
# This sets up a window for the command.&lt;br /&gt;
# This can be different to integrate with tkinter:&lt;br /&gt;
tk.eval ('set path &amp;quot;.dialog$dlg&amp;quot;')&lt;br /&gt;
tk.eval ('toplevel .dialog$dlg')&lt;br /&gt;
# Load the code for this command:&lt;br /&gt;
fd = os.popen (&amp;quot;d.vect --tcltk&amp;quot;)&lt;br /&gt;
gui = fd.read()&lt;br /&gt;
# Run it&lt;br /&gt;
tk.eval(gui)&lt;br /&gt;
dlg = tk.eval('set dlg') # This is used later to get and set &lt;br /&gt;
&lt;br /&gt;
# Get the current command in the gui we just made:&lt;br /&gt;
currentcommand = tk.eval (&amp;quot;dialog_get_command &amp;quot; + dlg)&lt;br /&gt;
&lt;br /&gt;
# Set the command in the dialog we just made:&lt;br /&gt;
tk.eval (&amp;quot;dialog_set_command &amp;quot; + dlg + &amp;quot; {d.vect map=roads}&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FAQ ==&lt;br /&gt;
&lt;br /&gt;
* '''Q:''' Error message &amp;quot;execl() failed: Permission denied&amp;quot; - what to do?&lt;br /&gt;
: '''A:''' Be sure that the execute bit of the script is set.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== General guides ===&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikibooks.org/wiki/Python_Programming/ Wikibook Python Programming]&lt;br /&gt;
* [http://www.poromenos.org/tutorials/python Quick Python tutorial] for programmers of other languages&lt;br /&gt;
*: [http://wiki.python.org/moin/BeginnersGuide/Programmers More Python tutorials] for programmers&lt;br /&gt;
* [http://www.python.org/dev/peps/pep-0008/ Python programming style guide]&lt;br /&gt;
* [http://wiki.python.org/moin/PythonEditors Python Editors]&lt;br /&gt;
&lt;br /&gt;
=== Programming ===&lt;br /&gt;
&lt;br /&gt;
* Python and GRASS:&lt;br /&gt;
** Library interfaces: [GRASS Python Scripting Library http://grass.osgeo.org/programming7/pythonlib.html]&lt;br /&gt;
** Graphical user interface (GIU): [GRASS wxPython-based GUI http://grass.osgeo.org/programming7/wxpythonlib.html]&lt;br /&gt;
** PyWPS, GRASS-Web Processing Service: [[WPS]]&lt;br /&gt;
&lt;br /&gt;
* Python and OSGeo:&lt;br /&gt;
** [http://wiki.osgeo.org/wiki/OSGeo_Python_Library OSGeo Python Library]&lt;br /&gt;
&lt;br /&gt;
* Python and GDAL/OGR:&lt;br /&gt;
** [http://mapserver.gis.umn.edu/community/conferences/MUM3/workshop/python Open Source Python GIS Hacks Mum'03]&lt;br /&gt;
** http://hobu.biz/software/OSGIS_Hacks - Python OSGIS Hacks '05&lt;br /&gt;
** http://zcologia.com/news/categorylist_html?cat_id=8&lt;br /&gt;
** http://www.perrygeo.net/wordpress/?p=4&lt;br /&gt;
&lt;br /&gt;
* Python bindings to PROJ:&lt;br /&gt;
** http://www.cdc.noaa.gov/people/jeffrey.s.whitaker/python/pyproj.html&lt;br /&gt;
&lt;br /&gt;
* Python and GIS:&lt;br /&gt;
** [http://gispython.org/ Open Source GIS-Python Laboratory]&lt;br /&gt;
&lt;br /&gt;
* Python and Statistics:&lt;br /&gt;
** [http://rpy.sourceforge.net/ RPy] - Python interface to the R-statistics programming language&lt;br /&gt;
&lt;br /&gt;
* Bindings:&lt;br /&gt;
** SIP (C/C++ bindings generator) http://directory.fsf.org/all/Python-SIP.html&lt;br /&gt;
** [http://www.cython.org/ Cython] - C-Extensions for Python (compile where speed is needed)&lt;br /&gt;
&lt;br /&gt;
* Other external projects&lt;br /&gt;
** [http://www.scipy.org Scientific Python]&lt;br /&gt;
** [http://wiki.python.org/moin/NumericAndScientific Numeric and Scientific]&lt;br /&gt;
** [http://w3.pppl.gov/~hammett/comp/python/python.html Info on Python for Scientific Applications]&lt;br /&gt;
&lt;br /&gt;
=== Presentations ===&lt;br /&gt;
&lt;br /&gt;
From FOSS4G2006:&lt;br /&gt;
* [http://www.foss4g2006.org/materialDisplay.py?contribId=136&amp;amp;amp;sessionId=48&amp;amp;amp;materialId=slides&amp;amp;amp;confId=1 A Python sweeps in the GRASS] - A. Frigeri 2006&lt;br /&gt;
* [http://www.foss4g2006.org/materialDisplay.py?contribId=67&amp;amp;amp;sessionId=48&amp;amp;amp;materialId=slides&amp;amp;amp;confId=1 GRASS goes web: PyWPS] - J. Cepicky 2006 (see also [[WPS]])&lt;br /&gt;
&lt;br /&gt;
{{Python}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Visit [http://whatiscasinos.co.uk/ Palace casino],for a very enjoyable, gambling and gaming experience, the smoke free hotel offers great service and food that is loved by all. If you love slots then you will definitely enjoy playing the game and have great winnings.&lt;br /&gt;
&lt;br /&gt;
[http://play-black-jack.co.uk/ Free online blackjack] is offered in almost all the casinos online, you can play the game free and enhance your skills before playing for real money in a casino.&lt;br /&gt;
&lt;br /&gt;
If you are unfamiliar with the rules of casino blackjack or simply need some clarification on the finer points, then play [http://black-jackonline.co.uk/ blackjack free online] and get familiar with the various odds and rules.&lt;br /&gt;
&lt;br /&gt;
Play [http://acasinoroyale.com free casino slot] and get the confidence to join the progressive jackpots and professional tournament plays to win great from the game.&lt;br /&gt;
&lt;br /&gt;
Shops for [http://play-pokergames.com/ Cheap poker tables] online, of different shapes, made with different materials and along with different features, compare the costs easily and find a higher variety to choose from.&lt;br /&gt;
&lt;br /&gt;
The [http://casinoin-uk.co.uk royal casino] online offers you over 3000 online games that are free to download, including flash games , internet casino games , gambling games and various other games to best enjoy.&lt;br /&gt;
&lt;br /&gt;
A [http://www.bunnypokers.com/ poker tournament] is a tournament where players compete by playing poker. It can feature as few as two players or numerous players playing on a single table.&lt;br /&gt;
&lt;br /&gt;
[http://casinoonlinebestguide.com/ Winstar casino] offers a world of luxury, excitement and entertainment. It features the best in casino games and offers daily, weekly and monthly poker tournaments and also offer great promotions to take advantage of.&lt;br /&gt;
&lt;br /&gt;
[http://casinooonlineguide.com/ River rock casino] in northern California features slot machines, table games, casino games, and a variety of dining options with live entertainment, shows and events. It is a certified 4 star casino in the Alexander valley.&lt;br /&gt;
&lt;br /&gt;
Visit the [http://findbestcasinoguide.com/ choctaw casino] that is a premiere Oklahoma casino, and is an ultimate destination for Poker, Blackjack and slots, you can also have the best of entertainment at the live shows and events and have the best accommodations and hospitality.&lt;br /&gt;
&lt;br /&gt;
[http://findoninecasino.com/ Casino in michigan] feature slot machines and table games, the Blue Chip Casino &amp;amp; Hotel is the best in Michigan spread over 42500 square feet it is the largest casino in Michigan City.&lt;br /&gt;
&lt;br /&gt;
Join the [http://asunbingo.co.uk play free bingo] online and have free bingo fun, free bingo bonus offers, free bingo deals, and free bingo promotions to have a great time while you experience bingo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://anewbingo.co.uk/ New billy bingo] is the no.1 multi award winning bingo companies that offers a great range of promotions, games to ensure that you have the best bingo gambling experience.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;[http://afoxybingo.co.uk/ Foxy bingo online] was launched in 2005 and is now one of the biggest names in UK bingo industry. When you deposit £10 we'll give you £20 for free.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://costabingoonline.co.uk/ Cheeky bingo online] offer all the regular types of games, including both 90 and 75 ball games, in the cheaper 5p and 10p rooms, join the site to enjoy great winnings and also take part in the various on-going jackpots and tournaments.&lt;br /&gt;
&lt;br /&gt;
Some of the best bingo games and offers can be claimed at the popular [http://newladbrokesbingo.co.uk/ bingo sites uk] like the foxy bingo, the wink bingo and the 123 bingo and many more.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://bestroulettetable.co.uk/ Online roulette] plays are the best, compared to the land plays they are convenient, and are easily available with best of offers, bonuses, promotions and free opportunities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The [http://free-roulette-online.co.uk/ best roulette strategy] is to practice the game, learn the odds, the rules and try the different variations, get used to the tae before you wager, with knowledge and practice you can definitely be a great roulette gambler and [http://free-roulette-online.co.uk/ play free roulette online].&lt;br /&gt;
&lt;br /&gt;
An online casino offer a wide variety of bonuses and offers, review sites will reveal the addresses of the sites that offer the [http://playbestcasinogames.co.uk/ best casino bonuses].&lt;br /&gt;
&lt;br /&gt;
[http://777pokergame.co.uk/ Play poker online] and experience the most popular casino game from your comfort zone conveniently.&lt;/div&gt;</summary>
		<author><name>⚠️BobbySaunders</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Python&amp;diff=16470</id>
		<title>GRASS and Python</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Python&amp;diff=16470"/>
		<updated>2012-09-20T12:47:56Z</updated>

		<summary type="html">&lt;p&gt;⚠️BobbySaunders: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Python SIGs==&lt;br /&gt;
Python Special Interest Groups are focused collaborative efforts to develop, improve, or maintain specific Python resources. Each SIG has a charter, a coordinator, a mailing list, and a directory on the Python website. SIG membership is informal, defined by subscription to the SIG's mailing list. Anyone can join a SIG, and participate in the development discussions via the SIG's mailing list. Below is the list of currently active Python SIGs, with links to their resources. &lt;br /&gt;
&lt;br /&gt;
See more at http://www.python.org/community/sigs/&lt;br /&gt;
&lt;br /&gt;
==Writing Python scripts in GRASS==&lt;br /&gt;
&lt;br /&gt;
Python is a programming language which is more powerful than shell scripting but easier and more forgiving than C.&lt;br /&gt;
The Python script can contain simple module description definitions which will be processed with {{cmd|g.parser}}, as shown in the example below. In this way with no extra coding a GUI can be built, inputs checked, and a skeleton help page can be generated automatically. In addition it adds links to the GRASS message translation system. The library for &amp;quot;scripting&amp;quot; is &amp;quot;grass.script&amp;quot;, typically used as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import grass.script as grass&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The related files are at $GISBASE/etc/python/grass/script/*.py. See below for more details.&lt;br /&gt;
&lt;br /&gt;
''Note: For code which needs access to the power of C, you can access the GRASS C library functions via [[GRASS and Python#Python Ctypes Interface|the Python &amp;quot;ctypes&amp;quot; interface]].''&lt;br /&gt;
&lt;br /&gt;
=== Python script editor ===&lt;br /&gt;
&lt;br /&gt;
The [[wxGUI]] Layer Manager in GRASS 6.4.3+ comes with a &amp;quot;Python shell&amp;quot; which enables users to type and execute python commands directly in wxGUI environment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wxgui-pyshell.png|center|350px|Embedded interactive Python Shell in wxGUI Layer Manager]]&lt;br /&gt;
&lt;br /&gt;
=== Using the GRASS Python Scripting Library ===&lt;br /&gt;
&lt;br /&gt;
You can run Python scripts easily in a GRASS session.&lt;br /&gt;
&lt;br /&gt;
To write these scripts, &lt;br /&gt;
* check the code in lib/python/ which provides grass.script in order to support GRASS scripts written in Python.&amp;lt;br&amp;gt;&lt;br /&gt;
  See the [[GRASS Python Scripting Library]] for notes and examples.&lt;br /&gt;
* The scripts/ directory of GRASS contains a series of examples actually provided to the end users.&lt;br /&gt;
&lt;br /&gt;
For the desired Python code style, have a look at {{src|SUBMITTING_PYTHON}}.&lt;br /&gt;
&lt;br /&gt;
=== Creating Python scripts that call GRASS functionality from outside ===&lt;br /&gt;
&lt;br /&gt;
Note: This is a more advanced use case of using GRASS' functionality from outside via Python. Commonly, a user will run GRASS Python script from inside a GRASS session, i.e. either from the command line or from the Python shell embedded in the wxGUI ([[:File:Wxgui-pyshell.png|screenshot]]).&lt;br /&gt;
&lt;br /&gt;
For calling GRASS functionality from outside, see also [[Working with GRASS without starting it explicitly]].&lt;br /&gt;
&lt;br /&gt;
==== MS-Windows ====&lt;br /&gt;
&lt;br /&gt;
In order to use GRASS functionality via Python from outside, some environment variables have to be set:&lt;br /&gt;
&lt;br /&gt;
 GISBASE= C:\GRASS-64&lt;br /&gt;
 GISRC= C:\Documents and Settings\user\.grassrc6&lt;br /&gt;
 LD_LIBRARY_PATH= C:\GRASS-64\lib&lt;br /&gt;
 PATH= C:\GRASS-64\etc;C:\GRASS-64\etc\python;C:\GRASS-64\lib;C:\GRASS-64\bin;C:\GRASS-64\extralib;C:\GRASS-64\msys\bin;C:\Python26;&lt;br /&gt;
 PYTHONLIB= C:\Python26&lt;br /&gt;
 PYTHONPATH= C:\GRASS-64\etc\python&lt;br /&gt;
 GRASS_SH= C:\GRASS-64\msys\bin\sh.exe&lt;br /&gt;
&lt;br /&gt;
At the super casino that plays are tested by TST this is an independent tester of software and the transactions are theft-proof as the casino is managed by 128-bit SSL encryption. If you further have any question or complaints you can seek he assistance of polite and helpful support team to answer, your queries, questions you can contact the support team 24/7. Moreover the [http://supercasino-games.co.uk/ super casino game] is commitment to responsible gaming that will help the gamblers stay within limits.&lt;br /&gt;
&lt;br /&gt;
Some hints:&lt;br /&gt;
&lt;br /&gt;
# The Python interpreter (python.exe) needs to be in the PATH&lt;br /&gt;
# Python needs to be associated with the .py extension&lt;br /&gt;
# PATHEXT needs to include .py if you want to be able to omit the extension&lt;br /&gt;
# PYTHONPATH needs to be set to %GISBASE%\etc\python&lt;br /&gt;
&lt;br /&gt;
1-3 should be taken care of by the Python installer. 4 needs to be done by the startup (currently, this doesn't appear to be the case on MS-Windows).&lt;br /&gt;
&lt;br /&gt;
==== Linux ====&lt;br /&gt;
&lt;br /&gt;
In order to use GRASS functionality via Python from outside, some environment variables have to be set:&lt;br /&gt;
&lt;br /&gt;
 export GISBASE=&amp;quot;/usr/local/grass-6.4.svn/&amp;quot;&lt;br /&gt;
 export PATH=&amp;quot;$PATH:$GISBASE/bin:$GISBASE/scripts&amp;quot;&lt;br /&gt;
 export LD_LIBRARY_PATH=&amp;quot;$LD_LIBRARY_PATH:$GISBASE/lib&amp;quot;&lt;br /&gt;
 # for parallel session management, we use process ID (PID) as lock file number:&lt;br /&gt;
 export GIS_LOCK=$$&lt;br /&gt;
 # path to GRASS settings file&lt;br /&gt;
 export GISRC=&amp;quot;$HOME/.grassrc6&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Running external commands from Python ===&lt;br /&gt;
For information on running external commands from Python, see:&lt;br /&gt;
http://docs.python.org/lib/module-subprocess.html&lt;br /&gt;
&lt;br /&gt;
Avoid using the older os.* functions. Section 17.1.3 lists equivalents&lt;br /&gt;
using the Popen() interface, which is more robust (particularly on&lt;br /&gt;
Windows).&lt;br /&gt;
&lt;br /&gt;
=== Testing and installing Python extensions ===&lt;br /&gt;
&lt;br /&gt;
==== Debugging ====&lt;br /&gt;
&lt;br /&gt;
Make sure the script is executable:&lt;br /&gt;
&lt;br /&gt;
    chmod +x /path/to/my.extension.py&lt;br /&gt;
&lt;br /&gt;
During development, a Python script can be debugged using the Python Debugger (pdb):&lt;br /&gt;
&lt;br /&gt;
    python -m pdb /path/to/my.extension.py input=my_input_layer output=my_output_layer option=value -f&lt;br /&gt;
&lt;br /&gt;
==== Installation ====&lt;br /&gt;
&lt;br /&gt;
Once you're happy with your script, you can put it in the scripts/ folder of your GRASS install. To do so, first create a directory named after your extension, then create a Makefile for it, and a HTML man page:&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/grass_src/&lt;br /&gt;
    cd scripts&lt;br /&gt;
    ls # It is useful to check out the existing scripts and their structure&lt;br /&gt;
    mkdir my.extension&lt;br /&gt;
    cd my.extension&lt;br /&gt;
    cp path/to/my.extension.py .&lt;br /&gt;
    touch my.extension.html&lt;br /&gt;
    touch Makefile&lt;br /&gt;
&lt;br /&gt;
Next step is to edit the Makefile. It is a very simple text file, the only thing to check is to put the right extension name (WITHOUT the .py file extension) after PGM:&lt;br /&gt;
&lt;br /&gt;
    MODULE_TOPDIR = ../..&lt;br /&gt;
    &lt;br /&gt;
    PGM = my.extension&lt;br /&gt;
    &lt;br /&gt;
    include $(MODULE_TOPDIR)/include/Make/Script.make&lt;br /&gt;
    &lt;br /&gt;
    default: script&lt;br /&gt;
&lt;br /&gt;
The HTML file would be generated automatically. If you want to add more precisions in it, you can do it (just make sure you start at DESCRIPTION. See existing scripts.)&lt;br /&gt;
&lt;br /&gt;
You can then run &amp;quot;make&amp;quot; within the my.extension folder. Running &amp;quot;make&amp;quot; in the extension directory places the resulting files in the staging directory (path/to/grass_src/dist.&amp;lt;YOUR_ARCH&amp;gt;/). If you're running GRASS from the staging directory (/path/to/grass_src/bin.&amp;lt;YOUR_ARCH&amp;gt;/grass7), subsequent commands will used the updated files. &lt;br /&gt;
&lt;br /&gt;
    # in your extension directory (/path/to/grass_src/scripts/my.extension/)&lt;br /&gt;
    make&lt;br /&gt;
    # Starting GRASS from the staging directory&lt;br /&gt;
    /path/to/grass_src/bin.&amp;lt;YOUR_ARCH&amp;gt;/grass7&lt;br /&gt;
    my.extension help&lt;br /&gt;
&lt;br /&gt;
You can also run &amp;quot;make install&amp;quot; from the top level directory of your GRASS install (say /usr/local/src/grass_trunk/). Running &amp;quot;make install&amp;quot; from the top level just copies the whole of the dist.&amp;lt;YOUR_ARCH&amp;gt;/ directory to the installation directory (e.g. /usr/local/grass70) and the bin.&amp;lt;YOUR_ARCH&amp;gt;/grass70 bin file to the bin directory (e.g. /usr/local/bin), and fixes any embedded paths in scripts and configuration files.&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/grass_src&lt;br /&gt;
    make install&lt;br /&gt;
    # Starting GRASS as usual would work and show your extension available&lt;br /&gt;
    grass7&lt;br /&gt;
    my.extension help&lt;br /&gt;
&lt;br /&gt;
==Python extensions in GRASS GIS==&lt;br /&gt;
&lt;br /&gt;
=== Python Scripting Library ===&lt;br /&gt;
&lt;br /&gt;
* See [[GRASS Python Scripting Library]]&lt;br /&gt;
&lt;br /&gt;
=== Python Ctypes Interface ===&lt;br /&gt;
&lt;br /&gt;
This interface allows calling GRASS library functions from Python scripts. See [[Python Ctypes Examples]] for details.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
* GRASS 7: [http://trac.osgeo.org/grass/browser/grass/trunk/doc/python/raster_example_ctypes.py raster], [http://trac.osgeo.org/grass/browser/grass/trunk/doc/python/vector_example_ctypes.py vector] example&lt;br /&gt;
&lt;br /&gt;
* Latest and greatest: GRASS 7 Python {{src|scripts}}&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strike&amp;gt;[[PythonSwigExamples|More complicated examples]]&amp;lt;/strike&amp;gt; &amp;lt;&amp;lt;-- TODO: update to Ctypes&lt;br /&gt;
&lt;br /&gt;
Sample script for GRASS 6 raster access (use within GRASS, Spearfish session):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
&lt;br /&gt;
## TODO: update example to Ctypes&lt;br /&gt;
&lt;br /&gt;
import os, sys&lt;br /&gt;
from grass.lib import grass&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;GISBASE&amp;quot; not in os.environ:&lt;br /&gt;
    print &amp;quot;You must be in GRASS GIS to run this program.&amp;quot;&lt;br /&gt;
    sys.exit(1)&lt;br /&gt;
&lt;br /&gt;
if len(sys.argv)==2:&lt;br /&gt;
  input = sys.argv[1]&lt;br /&gt;
else:&lt;br /&gt;
  input = raw_input(&amp;quot;Raster Map Name? &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
grass.G_gisinit('')&lt;br /&gt;
&lt;br /&gt;
# find map in search path&lt;br /&gt;
mapset = grass.G_find_cell2(input, '')&lt;br /&gt;
&lt;br /&gt;
# determine the inputmap type (CELL/FCELL/DCELL) */&lt;br /&gt;
data_type = grass.G_raster_map_type(input, mapset)&lt;br /&gt;
&lt;br /&gt;
infd = grass.G_open_cell_old(input, mapset)&lt;br /&gt;
inrast = grass.G_allocate_raster_buf(data_type)&lt;br /&gt;
&lt;br /&gt;
rown = 0&lt;br /&gt;
while True:&lt;br /&gt;
    myrow = grass.G_get_raster_row(infd, inrast, rown, data_type)&lt;br /&gt;
    print rown, myrow[0:10]&lt;br /&gt;
    rown += 1&lt;br /&gt;
    if rown == 476:&lt;br /&gt;
        break&lt;br /&gt;
&lt;br /&gt;
grass.G_close_cell(inrast)&lt;br /&gt;
grass.G_free(cell)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample script for vector access (use within GRASS, Spearfish session):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
# run within GRASS Spearfish session&lt;br /&gt;
# run this before starting python to append module search path:&lt;br /&gt;
#   export PYTHONPATH=/usr/src/grass70/swig/python&lt;br /&gt;
#   check with &amp;quot;import sys; sys.path&amp;quot;&lt;br /&gt;
# or:&lt;br /&gt;
#   sys.path.append(&amp;quot;/usr/src/grass70/swig/python&amp;quot;)&lt;br /&gt;
# FIXME: install the grass bindings in $GISBASE/lib/ ?&lt;br /&gt;
&lt;br /&gt;
import os, sys&lt;br /&gt;
from grass.lib import grass&lt;br /&gt;
from grass.lib import vector as grassvect&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;GISBASE&amp;quot; not in os.environ:&lt;br /&gt;
    print &amp;quot;You must be in GRASS GIS to run this program.&amp;quot;&lt;br /&gt;
    sys.exit(1)&lt;br /&gt;
&lt;br /&gt;
if len(sys.argv)==2:&lt;br /&gt;
  input = sys.argv[1]&lt;br /&gt;
else:&lt;br /&gt;
  input = raw_input(&amp;quot;Vector Map Name? &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
grass.G_gisinit('')&lt;br /&gt;
&lt;br /&gt;
# find map in search path&lt;br /&gt;
mapset = grass.G_find_vector2(input,'')&lt;br /&gt;
&lt;br /&gt;
# define map structure&lt;br /&gt;
map = grassvect.Map_info()&lt;br /&gt;
&lt;br /&gt;
# define open level (level 2: topology)&lt;br /&gt;
grassvect.Vect_set_open_level (2)&lt;br /&gt;
&lt;br /&gt;
# open existing map&lt;br /&gt;
grassvect.Vect_open_old(map, input, mapset)&lt;br /&gt;
&lt;br /&gt;
# query&lt;br /&gt;
print 'Vect map: ', input&lt;br /&gt;
print 'Vect is 3D: ', grassvect.Vect_is_3d (map)&lt;br /&gt;
print 'Vect DB links: ', grassvect.Vect_get_num_dblinks(map)&lt;br /&gt;
print 'Map Scale:  1:', grassvect.Vect_get_scale(map)&lt;br /&gt;
print 'Number of areas:', grassvect.Vect_get_num_areas(map)&lt;br /&gt;
&lt;br /&gt;
# close map&lt;br /&gt;
grassvect.Vect_close(map)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== wxPython GUI development ===&lt;br /&gt;
&lt;br /&gt;
* See the [[wxGUI]] wiki page&lt;br /&gt;
&lt;br /&gt;
=== Python-GRASS add-ons ===&lt;br /&gt;
&lt;br /&gt;
Stand-alone addons:&lt;br /&gt;
&lt;br /&gt;
* Jáchym Čepický's PyWPS, GRASS-Web Processing Service (http://pywps.wald.intevation.org)&lt;br /&gt;
&lt;br /&gt;
=== Using GRASS gui.tcl in Python ===&lt;br /&gt;
&lt;br /&gt;
Here is some example code to use the grass automatically generated guis in python code. This could (should) all be bundled up and abstracted away so that the implementation can be replaced later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import Tkinter&lt;br /&gt;
import os&lt;br /&gt;
&lt;br /&gt;
# Startup (once):&lt;br /&gt;
&lt;br /&gt;
tk = Tkinter.Tk()&lt;br /&gt;
tk.eval (&amp;quot;wm withdraw .&amp;quot;)&lt;br /&gt;
tk.eval (&amp;quot;source $env(GISBASE)/etc/gui.tcl&amp;quot;)&lt;br /&gt;
# Here you could do various things to change what the gui does&lt;br /&gt;
# See gui.tcl and README.GUI&lt;br /&gt;
&lt;br /&gt;
# Make a gui (per dialog)&lt;br /&gt;
# This sets up a window for the command.&lt;br /&gt;
# This can be different to integrate with tkinter:&lt;br /&gt;
tk.eval ('set path &amp;quot;.dialog$dlg&amp;quot;')&lt;br /&gt;
tk.eval ('toplevel .dialog$dlg')&lt;br /&gt;
# Load the code for this command:&lt;br /&gt;
fd = os.popen (&amp;quot;d.vect --tcltk&amp;quot;)&lt;br /&gt;
gui = fd.read()&lt;br /&gt;
# Run it&lt;br /&gt;
tk.eval(gui)&lt;br /&gt;
dlg = tk.eval('set dlg') # This is used later to get and set &lt;br /&gt;
&lt;br /&gt;
# Get the current command in the gui we just made:&lt;br /&gt;
currentcommand = tk.eval (&amp;quot;dialog_get_command &amp;quot; + dlg)&lt;br /&gt;
&lt;br /&gt;
# Set the command in the dialog we just made:&lt;br /&gt;
tk.eval (&amp;quot;dialog_set_command &amp;quot; + dlg + &amp;quot; {d.vect map=roads}&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FAQ ==&lt;br /&gt;
&lt;br /&gt;
* '''Q:''' Error message &amp;quot;execl() failed: Permission denied&amp;quot; - what to do?&lt;br /&gt;
: '''A:''' Be sure that the execute bit of the script is set.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== General guides ===&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikibooks.org/wiki/Python_Programming/ Wikibook Python Programming]&lt;br /&gt;
* [http://www.poromenos.org/tutorials/python Quick Python tutorial] for programmers of other languages&lt;br /&gt;
*: [http://wiki.python.org/moin/BeginnersGuide/Programmers More Python tutorials] for programmers&lt;br /&gt;
* [http://www.python.org/dev/peps/pep-0008/ Python programming style guide]&lt;br /&gt;
* [http://wiki.python.org/moin/PythonEditors Python Editors]&lt;br /&gt;
&lt;br /&gt;
=== Programming ===&lt;br /&gt;
&lt;br /&gt;
* Python and GRASS:&lt;br /&gt;
** Library interfaces: [GRASS Python Scripting Library http://grass.osgeo.org/programming7/pythonlib.html]&lt;br /&gt;
** Graphical user interface (GIU): [GRASS wxPython-based GUI http://grass.osgeo.org/programming7/wxpythonlib.html]&lt;br /&gt;
** PyWPS, GRASS-Web Processing Service: [[WPS]]&lt;br /&gt;
&lt;br /&gt;
* Python and OSGeo:&lt;br /&gt;
** [http://wiki.osgeo.org/wiki/OSGeo_Python_Library OSGeo Python Library]&lt;br /&gt;
&lt;br /&gt;
* Python and GDAL/OGR:&lt;br /&gt;
** [http://mapserver.gis.umn.edu/community/conferences/MUM3/workshop/python Open Source Python GIS Hacks Mum'03]&lt;br /&gt;
** http://hobu.biz/software/OSGIS_Hacks - Python OSGIS Hacks '05&lt;br /&gt;
** http://zcologia.com/news/categorylist_html?cat_id=8&lt;br /&gt;
** http://www.perrygeo.net/wordpress/?p=4&lt;br /&gt;
&lt;br /&gt;
* Python bindings to PROJ:&lt;br /&gt;
** http://www.cdc.noaa.gov/people/jeffrey.s.whitaker/python/pyproj.html&lt;br /&gt;
&lt;br /&gt;
* Python and GIS:&lt;br /&gt;
** [http://gispython.org/ Open Source GIS-Python Laboratory]&lt;br /&gt;
&lt;br /&gt;
* Python and Statistics:&lt;br /&gt;
** [http://rpy.sourceforge.net/ RPy] - Python interface to the R-statistics programming language&lt;br /&gt;
&lt;br /&gt;
* Bindings:&lt;br /&gt;
** SIP (C/C++ bindings generator) http://directory.fsf.org/all/Python-SIP.html&lt;br /&gt;
** [http://www.cython.org/ Cython] - C-Extensions for Python (compile where speed is needed)&lt;br /&gt;
&lt;br /&gt;
* Other external projects&lt;br /&gt;
** [http://www.scipy.org Scientific Python]&lt;br /&gt;
** [http://wiki.python.org/moin/NumericAndScientific Numeric and Scientific]&lt;br /&gt;
** [http://w3.pppl.gov/~hammett/comp/python/python.html Info on Python for Scientific Applications]&lt;br /&gt;
&lt;br /&gt;
=== Presentations ===&lt;br /&gt;
&lt;br /&gt;
From FOSS4G2006:&lt;br /&gt;
* [http://www.foss4g2006.org/materialDisplay.py?contribId=136&amp;amp;amp;sessionId=48&amp;amp;amp;materialId=slides&amp;amp;amp;confId=1 A Python sweeps in the GRASS] - A. Frigeri 2006&lt;br /&gt;
* [http://www.foss4g2006.org/materialDisplay.py?contribId=67&amp;amp;amp;sessionId=48&amp;amp;amp;materialId=slides&amp;amp;amp;confId=1 GRASS goes web: PyWPS] - J. Cepicky 2006 (see also [[WPS]])&lt;br /&gt;
&lt;br /&gt;
{{Python}}&lt;/div&gt;</summary>
		<author><name>⚠️BobbySaunders</name></author>
	</entry>
</feed>