Hi Michael, at the moment the WinGrass64-Installer ships it's own copy of python/wxpython (installed in C:\Program Files\GRASS-64-SVN\Python25). In the starting scripts (grass64.bat, Init.bat) the path to this python-copy is set.
the wingrass-installer adds in the windows-start-menue "GRASS Command Line". this starts Grass64 in text mode in a normal Windows-console (not in rxvt), but you can start the wxgui from this Windows-console inside a grass-session by the command "g.gui wxpython". and in this windows-console with the grass-session you have access to the wingrass-python-copy (installed in C:\Program Files\GRASS-64-SVN\Python25). for example you can start python inside a grass-session. maybe this could be a starting point for testing python-scripting in wingrass64? best regards Helmut --------------------- Von: Michael Barton <[email protected]> Gesendet: 03.04.2010 01:14:31 An: "Colin (Nielsen) Wren" <[email protected]>,Helmut Kudrnovsky <[email protected]> Betreff: Fwd: [GRASS-dev] Fwd: [GRASS-user] How to embed a grass script (for example v.db.addcol) into a Pythonscript on windows? Colin and Helmut, Is there some way that these suggestions can be implemented as default behavior in GRASS for Windows, or at least as an option? It is important that we can run scripts from Windows. Unfortunately, I don't understand this completely at the moment, but hope to test it out with students to get a clearer idea of how it all works. Michael ______________________________ C. Michael Barton Director, Center for Social Dynamics & Complexity Professor of Anthropology, School of Human Evolution & Social Change Arizona State University Tempe, AZ 85287-2402 USA voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC) fax: 480-965-7671(SHESC), 480-727-0709 (CSDC) www: [http://csdc.asu.edu], [http://shesc.asu.edu] [http://www.public.asu.edu/~cmbarton] Begin forwarded message: From: Glynn Clements <[[email protected]]> Date: April 2, 2010 3:54:22 PM MST To: Michael Barton <[[email protected]]> Cc: Isaac Ullah <[[email protected]]>, Andrea Torvinen <[[email protected]]>, GRASS developers grass-developers <[[email protected]]> Subject: Re: [GRASS-dev] Fwd: [GRASS-user] How to embed a grass script (for example v.db.addcol) into a Pythonscript on windows? Michael Barton wrote: OK. This helps. We were trying it in the "MSys' (broken and deprecated) rxvt program". Like I said, I'm not familiar enough with Windows to realize that this would not work. I'm trying to help get python GRASS scripts to work under Windows. So testing it from MSys is not the way to go. Should we just try running a python script from the wxpython command prompt? Or should we do it from the MSys prompt? First, I would suggest using the batch file which I posted (or something quite similar) to start a session using cmd.exe in a Windows console. For running a *script*, it shouldn't matter whether you use rxvt or a console, but it will matter for running Python interactively. Using bash might cause problems, so it's best to avoid that at first. Is there a shebang that we should be using on Windows that is different from the stock one (#!/usr/bin/env python). Shebangs don't work with Windows; that's a feature of MSys' bash. Windows uses the extension. If you've installed Python using the stock .msi installer from [python.org], it should have associated the .py extension with the python.file type, and the python.file type with something like: "C:\Python26\python.exe" "%1" %* I'm looking for a cookbook approach that I can tell to students and other who would like to use GRASS on Windows. I understand that there are difficulties with this, but am trying to find way to make scripting useable for people who cannot compile on Windows, but can modify batch and other scripts. So far, we've 1) installed Python from the python site 2) installed the GRASS binary (not the OSGeo4Win version, but the standalone native Windows one) 3) replaced the startup batch file with the commands you provided Do we need to do something else? Do we need to start a script in a special way (e.g., by exec-ing python first? Do we need batch files to launch python scripts like we do for bash scripts? 1. The Python scripts need to have a .py extension. 2. You may need: set PYTHONPATH=%WINGISBASE%\etc\python as grass65.bat (etc) only sets this when invoked with -wxpython. In a related question, maybe more for Colin, does GRASS 7 work in Windows? If so, what is the setup to allow it to run the scripts in Python? GRASS 7 works in Windows using a similar batch file to that which I posted for 6.x. However, the Init.bat file needs some work. Starting with -wxpython doesn't work (you can start it manually via g.gui, though). If you start in -text mode, you'll get a couple of errors about the missing set_data program, but you'll end up in a session using the existing .grassrc7 file (provided that one exists). -- Glynn Clements <[[email protected]]> ___________________________________________________________ NEU: WEB.DE DSL für 19,99 EUR/mtl. und ohne Mindest-Laufzeit! http://produkte.web.de/go/02/
_______________________________________________ grass-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-dev
