[GRASS-user] Error when running a scrip in Windows-WinGRASS

2010-09-30 Thread Helena Herrera
Greetings

I have developed a Script to import Landsat images that runs just fine in
Linux

But when I compile (Msys)  with this expressioN:
make -C r.in.landsat
MODULE_TOPDIR=/C/OSGeo4W/usr/src/grass-6.4.svn_src_snapshot_2010_09_04

and run in GRASS I get this error:

Traceback (most recent call last):
  File "C:/OSGeo4W/apps/grass/grass-6.4.1svn/etc/wxpython/wx
gui.py", line 486, in OnRunCmd
self.goutput.RunCmd(cmd, switchPage=False)
  File "C:\OSGeo4W\apps\grass\grass-6.4.1svn\etc\wxpython\gu
i_modules\goutput.py", line 368, in RunCmd
menuform.GUI().ParseCommand(cmdlist, parentframe=self)
  File "C:\OSGeo4W\apps\grass\grass-6.4.1svn\etc\wxpython\gu
i_modules\menuform.py", line 1866, in ParseCommand
xml.sax.parseString(getInterfaceDescription(cmd[0]).decode(e
nc).split('\n',1)[1].replace('', '\n', 1).encode("utf-8"),
IndexError
:
list index out of range
1- Is my compilation expression correct?

2- What am I missing on this?
Thanks
Helena
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error when running a scrip in Windows-WinGRASS

2010-10-01 Thread Glynn Clements

Helena Herrera wrote:

> I have developed a Script to import Landsat images that runs just fine in
> Linux
> 
> But when I compile (Msys)  with this expressioN:
> make -C r.in.landsat
> MODULE_TOPDIR=/C/OSGeo4W/usr/src/grass-6.4.svn_src_snapshot_2010_09_04
> 
> and run in GRASS I get this error:

> xml.sax.parseString(getInterfaceDescription(cmd[0]).decode(enc).split('\n',1)[1].replace('',
> '\n', 1).encode("utf-8"),

> IndexError: list index out of range
> 1- Is my compilation expression correct?
> 
> 2- What am I missing on this?

I'm not sure that Python scripts work in 6.x on Windows. I'm fairly
sure that the build system *doesn't* handle Python scripts in 6.x on
Windows.

The main issue is that, on Windows, the build system installs a batch
file which executes the actual script, and the batch file only works
for shell scripts.

-- 
Glynn Clements 
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error when running a scrip in Windows-WinGRASS

2010-10-04 Thread Helena Herrera
Greetings to all

I want to know if anyone has ever tried to build Python Scripts on winGRASS
6.x???
Because I didn't find any literature or document that this was a limition on
Windows...



On Fri, Oct 1, 2010 at 6:40 PM, Glynn Clements wrote:

>
> Helena Herrera wrote:
>
> > I have developed a Script to import Landsat images that runs just fine in
> > Linux
> >
> > But when I compile (Msys)  with this expressioN:
> > make -C r.in.landsat
> > MODULE_TOPDIR=/C/OSGeo4W/usr/src/grass-6.4.svn_src_snapshot_2010_09_04
> >
> > and run in GRASS I get this error:
>
> >
> xml.sax.parseString(getInterfaceDescription(cmd[0]).decode(enc).split('\n',1)[1].replace('',
> > '\n', 1).encode("utf-8"),
>
> > IndexError: list index out of range
> > 1- Is my compilation expression correct?
> >
> > 2- What am I missing on this?
>
> I'm not sure that Python scripts work in 6.x on Windows. I'm fairly
> sure that the build system *doesn't* handle Python scripts in 6.x on
> Windows.
>
> The main issue is that, on Windows, the build system installs a batch
> file which executes the actual script, and the batch file only works
> for shell scripts.
>
> --
> Glynn Clements 
>
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error when running a scrip in Windows-WinGRASS

2010-10-13 Thread M.Onur Kurum
 I've been a reader in the Grass-users list so far but I wanted to 
follow up with this:


I was trying to get a py script running under Grass 6.4 and 7.0
OS: WIndows 7 64 bit

Here are the results of my experiments, I will try to provide as much 
detail as I can:


I am using http://svn.osgeo.org/grass/grass-addons/raster/r.ipso/ for my 
tests:


GRASS64
I have GRASS 64 installed in C:\GRASS-64
I put the the r.ipso.py in C:\GRASS-64\scripts
I launch the GRASS 6.4.0 with MSYS

when I directly try to launch the module, I get this:

*GRASS 6.4> r.ipso.py
Traceback (most recent call last):
  File "c:/GRASS-64/scripts/r.ipso.py", line 53, in 
import matplotlib.pyplot as plt
  File "C:\GRASS-64\Python25\lib\site-packages\matplotlib\pyplot.py", 
line 78, in 

new_figure_manager, draw_if_interactive, show = pylab_setup()
  File 
"C:\GRASS-64\Python25\lib\site-packages\matplotlib\backends\__init__.py", line 
25, in pylab_setup

globals(),locals(),[backend_name])
  File 
"C:\GRASS-64\Python25\lib\site-packages\matplotlib\backends\backend_tkagg.py", 
line 7, in 

import Tkinter as Tk, FileDialog
ImportError: No module named Tkinter*

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)

apparently python26 interpreter can run the matplotlib better(?).
so I did:

*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"

GRASS 6.4> export PYTHONHOME="/C/Python26"
*
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:


*GRASS 6.4> r.ipso.py
c:/Python26\lib\site.py:150: Warning: 'with' will become a reserved 
keyword in Python 2.6

'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "c:/GRASS-70-SVN/scripts/r.ipso.py", line 52, in 
import os
  File "c:/Python26\lib\os.py", line 758
bs = b""
   ^
SyntaxError: invalid syntax*

so anyway, I change the path as I mentioned above and the result is:

*GRASS 6.4> r.ipso.py
ERROR: Required parameter  not set:
(Name of raster map).
ERROR: Required parameter  not set:
(output graph).
Description:
Keywords:
 raster
Usage:
 r.ipso.py [-ab] map=name image=image [--verbose] [--quiet]

Flags:
  -a   generate ipsometric curve
  -b   generate ipsographic curve
 --v   Verbose module output
 --q   Quiet module output

Parameters:
map   Name of raster map
  image   output graph
GRASS 6.4> *

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.


I tried the same thing GRASS 7 too since it is all Python (which I love ! )

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)


*GRASS 7.0.svn> r.ipso.py
Traceback (most recent call last):
  File "c:/GRASS-70-SVN/scripts/r.ipso.py", line 53, in 
import matplotlib.pyplot as plt
ImportError: No module named matplotlib.pyplot*

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:


*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"

export PYTHONHOME="/C/Python26"*

again note that I don't have the extrabin folder in the PATH

*GRASS 7.0.svn> r.ipso.py
ERROR: wxGUI requires wxPython. No module named wxversion
GRASS 7.0.svn>
*
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.


Any ideas, suggestions ?
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


thanks
Onur






On 10/4/2010 2:41 PM, Helena Herrera wrote:

Greetings to all
I want to know if anyone has ever tried to build Python Scripts on 
winGRASS 6.x???
Because I didn't find any literature or document that this was a 
limition on Windows...



On Fri, Oct 1, 2010 at 6:40 PM, Glynn Clements 
mailto:gl...@gclements.plus.com>> wrote:



Helena Herrera wrote:

> I have developed a Script to import Landsat images that runs
just fine in
>

Re: [GRASS-user] Error when running a scrip in Windows-WinGRASS

2010-10-13 Thread Glynn Clements

M.Onur Kurum wrote:

> Any ideas, suggestions ?
> 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

For 7.0, remove any version of Python which is bundled with GRASS, and
remove any reference to it from the startup scripts. Just use the
installed version of Python.

The only thing which may be problematic is the wxPython digitiser
module. That includes a binary component which will only work with the
exact versions of Python and wxPython for which it was compiled. If
this module is present, you may need to remove it in order to start
the GUI.

-- 
Glynn Clements 
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error when running a scrip in Windows-WinGRASS

2010-10-14 Thread M.Onur Kurum
 I completely removed the Python25 bundled with GRASS and changed the 
startup bat file to not look for the bundled python so this is how it goes:


C:\GRASS-70-SVN>set_shell_start_grass70svn.bat
Cleaning up temporary files...
Starting GRASS GIS...
Traceback (most recent call last):
  File "C:\GRASS-70-SVN\etc\gui\wxpython\gis_set.py", line 38, in 
import gui_modules.goutput
  File "C:\GRASS-70-SVN\etc\gui\wxpython\gui_modules\goutput.py", line 
35, in 

import gcmd
  File "C:\GRASS-70-SVN\etc\gui\wxpython\gui_modules\gcmd.py", line 44, 
in 

from win32file import ReadFile, WriteFile
ImportError: No module named win32file
Error in GUI startup. If necessary, please report this error to the 
GRASS developers.

Switching to text mode now.

Hit RETURN to continue...

Traceback (most recent call last):
  File "C:\GRASS-70-SVN\grass70.py", line 956, in 
set_data()
  File "C:\GRASS-70-SVN\grass70.py", line 497, in set_data
gui_startup()
  File "C:\GRASS-70-SVN\grass70.py", line 519, in gui_startup
os.execlp(cmd_name, "-text")
  File "C:\Python26\lib\os.py", line 327, in execlp
execvp(file, args)
  File "C:\Python26\lib\os.py", line 344, in execvp
_execvpe(file, args)
  File "C:\Python26\lib\os.py", line 380, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory

I guess this is what you meant with
"The only thing which may be problematic is the wxPython digitiser module. "

for windows grass 7 comes bundled with python25 and now I use python26 
installed separately.

Could you be more specific about how to remove the module ? I am lost there.

in the bundled \Python25\Lib\site-packages\wx-2.8-msw-unicode I see that 
wxpython is

Metadata-Version: 1.0
Name: wxPython
Version: 2.8.9.1 for python 2.5

and the one in \Python26\Lib\site-packages\wx-2.8-msw-unicode is version 
2.8.11.0 for python 2.6


thanks
Onur


On 10/14/2010 2:44 AM, Glynn Clements wrote:

M.Onur Kurum wrote:


Any ideas, suggestions ?
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

For 7.0, remove any version of Python which is bundled with GRASS, and
remove any reference to it from the startup scripts. Just use the
installed version of Python.

The only thing which may be problematic is the wxPython digitiser
module. That includes a binary component which will only work with the
exact versions of Python and wxPython for which it was compiled. If
this module is present, you may need to remove it in order to start
the GUI.



--

M.Onur Kurum
Graduate Research Assistant
Dept. of Civil, Construction, and Environmental Engineering
North Carolina State University
Campus Box 7908
2501 Stinson Drive, 428 Mann Hall
Raleigh, NC  27695-7908
Office: (919) 515-1340
Mobile: (919) 200-0665
Email: moku...@ncsu.edu
Email: m.onur.ku...@gmail.com

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error when running a scrip in Windows-WinGRASS

2010-10-14 Thread Glynn Clements

M.Onur Kurum wrote:

>   I completely removed the Python25 bundled with GRASS and changed the 
> startup bat file to not look for the bundled python so this is how it goes:
> 
> C:\GRASS-70-SVN>set_shell_start_grass70svn.bat
> Cleaning up temporary files...
> Starting GRASS GIS...
> Traceback (most recent call last):
>File "C:\GRASS-70-SVN\etc\gui\wxpython\gis_set.py", line 38, in 
>  import gui_modules.goutput
>File "C:\GRASS-70-SVN\etc\gui\wxpython\gui_modules\goutput.py", line 
> 35, in 
>  import gcmd
>File "C:\GRASS-70-SVN\etc\gui\wxpython\gui_modules\gcmd.py", line 44, 
> in 
>  from win32file import ReadFile, WriteFile
> ImportError: No module named win32file

You need to install the pywin32 package.

http://sourceforge.net/projects/pywin32/

-- 
Glynn Clements 
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error when running a scrip in Windows-WinGRASS

2010-10-15 Thread M.Onur Kurum

 after installing pywin32 for python25, I get this error:

GRASS 7.0.svn> r.ipso.py
Traceback (most recent call last):
  File "C:\GRASS-70-SVN/etc/gui/wxpython/gui_modules/menuform.py", line 
2253, in 

task = grassTask(cmd[0])
  File "C:\GRASS-70-SVN/etc/gui/wxpython/gui_modules/menuform.py", line 
371, in __init__
processTask(tree = 
etree.fromstring(getInterfaceDescription(grassModule)),

  File "C:\Python25\lib\xml\etree\ElementTree.py", line 964, in XML
return parser.close()
  File "C:\Python25\lib\xml\etree\ElementTree.py", line 1254, in close
self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0
GRASS 7.0.svn>



On 10/15/2010 12:13 AM, Glynn Clements wrote:

M.Onur Kurum wrote:


   I completely removed the Python25 bundled with GRASS and changed the
startup bat file to not look for the bundled python so this is how it goes:

C:\GRASS-70-SVN>set_shell_start_grass70svn.bat
Cleaning up temporary files...
Starting GRASS GIS...
Traceback (most recent call last):
File "C:\GRASS-70-SVN\etc\gui\wxpython\gis_set.py", line 38, in
  import gui_modules.goutput
File "C:\GRASS-70-SVN\etc\gui\wxpython\gui_modules\goutput.py", line
35, in
  import gcmd
File "C:\GRASS-70-SVN\etc\gui\wxpython\gui_modules\gcmd.py", line 44,
in
  from win32file import ReadFile, WriteFile
ImportError: No module named win32file

You need to install the pywin32 package.

http://sourceforge.net/projects/pywin32/



--

M.Onur Kurum
Graduate Research Assistant
Dept. of Civil, Construction, and Environmental Engineering
North Carolina State University
Campus Box 7908
2501 Stinson Drive, 428 Mann Hall
Raleigh, NC  27695-7908
Office: (919) 515-1340
Mobile: (919) 200-0665
Email: moku...@ncsu.edu
Email: m.onur.ku...@gmail.com

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error when running a scrip in Windows-WinGRASS

2010-10-15 Thread Glynn Clements

M.Onur Kurum wrote:

>   after installing pywin32 for python25, I get this error:
> 
> GRASS 7.0.svn> r.ipso.py

>File "C:\Python25\lib\xml\etree\ElementTree.py", line 1254, in close
>  self._parser.Parse("", 1) # end of data
> xml.parsers.expat.ExpatError: no element found: line 1, column 0

This suggests that "r.ipso.py --interface-description" didn't produce
any output.

Try running it from the command line with the --help or
--interface-description switches. You may get a more informative error
message.

-- 
Glynn Clements 
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user