<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I've been a reader in the Grass-users list so far but I wanted to
follow up with this:<br>
<br>
I was trying to get a py script running under Grass 6.4 and 7.0 <br>
OS: WIndows 7 64 bit<br>
<br>
Here are the results of my experiments, I will try to provide as
much detail as I can:<br>
<br>
I am using <a class="moz-txt-link-freetext" href="http://svn.osgeo.org/grass/grass-addons/raster/r.ipso/">http://svn.osgeo.org/grass/grass-addons/raster/r.ipso/</a>
for my tests:<br>
<br>
GRASS64<br>
I have GRASS 64 installed in C:\GRASS-64<br>
I put the the r.ipso.py in C:\GRASS-64\scripts<br>
I launch the GRASS 6.4.0 with MSYS<br>
<br>
when I directly try to launch the module, I get this:<br>
<br>
<b>GRASS 6.4> r.ipso.py<br>
Traceback (most recent call last):<br>
File "c:/GRASS-64/scripts/r.ipso.py", line 53, in <module><br>
import matplotlib.pyplot as plt<br>
File
"C:\GRASS-64\Python25\lib\site-packages\matplotlib\pyplot.py",
line 78, in <module><br>
new_figure_manager, draw_if_interactive, show = pylab_setup()<br>
File
"C:\GRASS-64\Python25\lib\site-packages\matplotlib\backends\__init__.py",
line 25, in pylab_setup<br>
globals(),locals(),[backend_name])<br>
File
"C:\GRASS-64\Python25\lib\site-packages\matplotlib\backends\backend_tkagg.py",
line 7, in <module><br>
import Tkinter as Tk, FileDialog<br>
ImportError: No module named Tkinter</b><br>
<br>
I could workaround this problem by using the Python 26 installed
separately in C:\Python26 (which has numpy, matplotlib,
wx-2.8-msw-unicode (wxpython) etc)<br>
apparently python26 interpreter can run the matplotlib better(?).<br>
so I did:<br>
<br>
<b>GRASS 6.4> export
PATH="/C/GRASS-64/lib:/C/GRASS-64/bin:/C/GRASS-64/scripts:/C/GRASS-64/tcl-tk/bin:/C/GRASS-64/sqlite/bin:/C/GRASS-64/gpsbabel:/C/GRASS-64/extralib:/bin:/C/Python26"<br>
GRASS 6.4> export PYTHONHOME="/C/Python26"<br>
</b>
<br>
note that I removed the C/Grass-64/extrabin to prevent the
python.exe there to interfere with my python.exe (the one in
C:\Python26\) to execute - If I don't remove C/Grass-64/extrabin
from the PATH, here is the result:<br>
<br>
<b>GRASS 6.4> r.ipso.py<br>
c:/Python26\lib\site.py:150: Warning: 'with' will become a
reserved keyword in Python 2.6<br>
'import site' failed; use -v for traceback<br>
Traceback (most recent call last):<br>
File "c:/GRASS-70-SVN/scripts/r.ipso.py", line 52, in
<module><br>
import os<br>
File "c:/Python26\lib\os.py", line 758<br>
bs = b""<br>
^<br>
SyntaxError: invalid syntax</b><br>
<br>
so anyway, I change the path as I mentioned above and the result is:<br>
<br>
<b>GRASS 6.4> r.ipso.py<br>
ERROR: Required parameter <map> not set:<br>
(Name of raster map).<br>
ERROR: Required parameter <image> not set:<br>
(output graph).<br>
Description:<br>
Keywords:<br>
raster<br>
Usage:<br>
r.ipso.py [-ab] map=name image=image [--verbose] [--quiet]<br>
<br>
Flags:<br>
-a generate ipsometric curve<br>
-b generate ipsographic curve<br>
--v Verbose module output<br>
--q Quiet module output<br>
<br>
Parameters:<br>
map Name of raster map<br>
image output graph<br>
GRASS 6.4> </b>
<br>
<br>
so it works, I tried it with an input map and everything. It
creates the plot image and everything but the GUI does not launch
(in linux it does - everything works better there :) ). I want the
GUI so that when I create my own script I can check how the GUI
looks etc.<br>
<br>
I tried the same thing GRASS 7 too since it is all Python (which I
love ! )<br>
<br>
I get a different error when I go r.ipso.py just after launching
GRASS 7.0.SVN with MSYS (Grass7.0 is installed in C:\GRASS-70-SVN -
I mention this to let you know that I don't go with the default
C:\Program Files (X86)\GRASS..... which has spaces in it and it
creates all kinds of problems - I see that it is been fixed, but I
still feel this is safer)<br>
<br>
<b>GRASS 7.0.svn> r.ipso.py<br>
Traceback (most recent call last):<br>
File "c:/GRASS-70-SVN/scripts/r.ipso.py", line 53, in
<module><br>
import matplotlib.pyplot as plt<br>
ImportError: No module named matplotlib.pyplot</b><br>
<br>
the reason (probably), C:\GRASS-70-SVN\Python25\Lib\site-packages
does not come with matplotlib - anyway I trick it again to look for
libraries under my Python26 by exporting:<br>
<br>
<b>export
PATH="/C/GRASS-70-SVN/lib:/C/GRASS-70-SVN/bin:/C/GRASS-70-SVN/scripts:/C/GRASS-70-SVN/tcl-tk/bin:/C/GRASS-70-SVN/sqlite/bin:/c/GRASS-70-SVN/gpsbabel:/c/GRASS-70-SVN/extralib:/bin:/c/Python26"<br>
export PYTHONHOME="/C/Python26"</b><br>
<br>
again note that I don't have the extrabin folder in the PATH<br>
<br>
<b>GRASS 7.0.svn> r.ipso.py<br>
ERROR: wxGUI requires wxPython. No module named wxversion<br>
GRASS 7.0.svn><br>
</b>
<br>
This is where I am at right now - it seems that it is going to work
out if I figure out this last "ERROR: wxGUI requires wxPython. No
module named wxversion" problem in Grass-70.<br>
<br>
Any ideas, suggestions ?<br>
I just want to be able to launch the GUI when I have a .py of my own
under /scripts in grass6.4 or 7.0<br>
<br>
thanks<br>
Onur<br>
<br>
<br>
<br>
<br>
<br>
<br>
On 10/4/2010 2:41 PM, Helena Herrera wrote:
<blockquote
cite="mid:AANLkTi=LWc+hwXZ2KSE-gj5y1jGru77ncG6U9HmTrNZC@mail.gmail.com"
type="cite">
<div>Greetings to all</div>
<div> </div>
<div>I want to know if anyone has ever tried to build Python
Scripts on winGRASS 6.x??? </div>
<div>Because I didn't find any literature or document that this
was a limition on Windows...</div>
<div><br>
<br>
</div>
<div class="gmail_quote">On Fri, Oct 1, 2010 at 6:40 PM, Glynn
Clements <span dir="ltr"><<a
href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>></span>
wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204);
margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"
class="gmail_quote">
<div class="im"><br>
Helena Herrera wrote:<br>
<br>
> I have developed a Script to import Landsat images that
runs just fine in<br>
> Linux<br>
><br>
> But when I compile (Msys) with this expressioN:<br>
> make -C r.in.landsat<br>
>
MODULE_TOPDIR=/C/OSGeo4W/usr/src/grass-6.4.svn_src_snapshot_2010_09_04<br>
><br>
> and run in GRASS I get this error:<br>
<br>
</div>
>
xml.sax.parseString(getInterfaceDescription(cmd[0]).decode(enc).split('\n',1)[1].replace('',<br>
<div class="im">> '<?xml version="1.0"
encoding="utf-8"?>\n', 1).encode("utf-8"),<br>
<br>
> IndexError: list index out of range<br>
> 1- Is my compilation expression correct?<br>
><br>
> 2- What am I missing on this?<br>
<br>
</div>
I'm not sure that Python scripts work in 6.x on Windows. I'm
fairly<br>
sure that the build system *doesn't* handle Python scripts in
6.x on<br>
Windows.<br>
<br>
The main issue is that, on Windows, the build system installs
a batch<br>
file which executes the actual script, and the batch file only
works<br>
for shell scripts.<br>
<font color="#888888"><br>
--<br>
Glynn Clements <<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>><br>
</font></blockquote>
</div>
<br>
<pre>
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a>
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<style>p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman","serif"; }a:link, span.MsoHyperlink { color: blue; text-decoration: underline; }a:visited, span.MsoHyperlinkFollowed { color: purple; text-decoration: underline; }p { margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: "Times New Roman","serif"; }span.SpellE { }.MsoChpDefault { font-size: 10pt; }div.WordSection1 { page: WordSection1; }</style>
<div class="WordSection1">
<p style="margin: 0in 0in 0.0001pt;"><span class="SpellE">M.Onur</span>
Kurum<br>
Graduate Research Assistant<br>
Dept. of Civil, Construction, and Environmental Engineering<br>
North Carolina State University<br>
Campus Box 7908<br>
2501 Stinson Drive, 428 Mann Hall<br>
Raleigh, NC 27695-7908<br>
Office: (919) 515-1340<br>
Mobile: (919) 200-0665 <br>
Email: <a class="moz-txt-link-abbreviated" href="mailto:mokurum@ncsu.edu">mokurum@ncsu.edu</a><br>
Email: <a class="moz-txt-link-abbreviated" href="mailto:m.onur.kurum@gmail.com">m.onur.kurum@gmail.com</a></p>
</div>
</div>
<br>
<br>
On 10/4/2010 2:41 PM, Helena Herrera wrote:
<blockquote
cite="mid:AANLkTi=LWc+hwXZ2KSE-gj5y1jGru77ncG6U9HmTrNZC@mail.gmail.com"
type="cite">
<div>Greetings to all</div>
<div> </div>
<div>I want to know if anyone has ever tried to build Python
Scripts on winGRASS 6.x??? </div>
<div>Because I didn't find any literature or document that this
was a limition on Windows...</div>
<div><br>
<br>
</div>
<div class="gmail_quote">On Fri, Oct 1, 2010 at 6:40 PM, Glynn
Clements <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>></span>
wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204);
margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"
class="gmail_quote">
<div class="im"><br>
Helena Herrera wrote:<br>
<br>
> I have developed a Script to import Landsat images that
runs just fine in<br>
> Linux<br>
><br>
> But when I compile (Msys) with this expressioN:<br>
> make -C r.in.landsat<br>
>
MODULE_TOPDIR=/C/OSGeo4W/usr/src/grass-6.4.svn_src_snapshot_2010_09_04<br>
><br>
> and run in GRASS I get this error:<br>
<br>
</div>
>
xml.sax.parseString(getInterfaceDescription(cmd[0]).decode(enc).split('\n',1)[1].replace('',<br>
<div class="im">> '<?xml version="1.0"
encoding="utf-8"?>\n', 1).encode("utf-8"),<br>
<br>
> IndexError: list index out of range<br>
> 1- Is my compilation expression correct?<br>
><br>
> 2- What am I missing on this?<br>
<br>
</div>
I'm not sure that Python scripts work in 6.x on Windows. I'm
fairly<br>
sure that the build system *doesn't* handle Python scripts in
6.x on<br>
Windows.<br>
<br>
The main issue is that, on Windows, the build system installs
a batch<br>
file which executes the actual script, and the batch file only
works<br>
for shell scripts.<br>
<font color="#888888"><br>
--<br>
Glynn Clements <<a moz-do-not-send="true"
href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>><br>
</font></blockquote>
</div>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a>
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<style>p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman","serif"; }a:link, span.MsoHyperlink { color: blue; text-decoration: underline; }a:visited, span.MsoHyperlinkFollowed { color: purple; text-decoration: underline; }p { margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: "Times New Roman","serif"; }span.SpellE { }.MsoChpDefault { font-size: 10pt; }div.WordSection1 { page: WordSection1; }</style>
<div class="WordSection1">
<p style="margin: 0in 0in 0.0001pt;"><span class="SpellE">M.Onur</span>
Kurum<br>
Graduate Research Assistant<br>
Dept. of Civil, Construction, and Environmental Engineering<br>
North Carolina State University<br>
Campus Box 7908<br>
2501 Stinson Drive, 428 Mann Hall<br>
Raleigh, NC 27695-7908<br>
Office: (919) 515-1340<br>
Mobile: (919) 200-0665 <br>
Email: <a class="moz-txt-link-abbreviated" href="mailto:mokurum@ncsu.edu">mokurum@ncsu.edu</a><br>
Email: <a class="moz-txt-link-abbreviated" href="mailto:m.onur.kurum@gmail.com">m.onur.kurum@gmail.com</a></p>
</div>
</div>
</body>
</html>