Greetings
I was developing a special import script (for a designated dataset) and I used r.in.aster Python Script (GRASS7) as a based for this Python script in GRASS6.4.. It compiled but I got this error:
make: Entering directory `/home/anrr/Desktop/dwe_devep/r.in.globcover.py'
if [ ! -d /usr/local/grass-6.4.0svn/scripts ]; then mkdir -p /usr/local/grass-6.4.0svn/scripts; fi
/usr/bin/install -c r.in.globcover.py /usr/local/grass-6.4.0svn/scripts/r.in.globcover.py
make htmlscript scriptstrings
make[1]: Entering directory `/home/anrr/Desktop/dwe_devep/r.in.globcover.py'
make /usr/local/grass-6.4.0svn/docs/html/r.in.globcover.py.html HTMLSRC=/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py
make[2]: Entering directory `/home/anrr/Desktop/dwe_devep/r.in.globcover.py'
if [ "/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py" != "" ] ; then GISRC=/usr/local/grass-6.4.0svn/demolocation/grassrc64 GISBASE=/usr/local/grass-6.4.0svn PATH="/usr/local/grass-6.4.0svn/bin:$PATH" LD_LIBRARY_PATH="/usr/local/grass-6.4.0svn/bin:/usr/local/grass-6.4.0svn/lib:" LC_ALL=C /usr/local/grass-6.4.0svn/scripts/r.in.globcover.py --html-description < /dev/null | grep -v '</body>\|</html>' > r.in.globcover.py.tmp.html ; true ; fi
Traceback (most recent call last):
File "/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py", line 50, in <module>
import grass.script as grass
*ImportError: No module named grass.script*
I thought GRASS6.4 Python's script already had this module. Is not available?
Just one last question: How can I retrieve image projection, using a Python script, with tghe same information-structure I get when I use: grass.read_command('g.proj', flags = 'jf').strip()
Thanks
Best regards,
Antonio Rocha
__________ Information from ESET NOD32 Antivirus, version of virus signature database 5215 (20100621) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
António Rocha wrote:
I was developing a special import script (for a designated dataset) and
I used r.in.aster Python Script (GRASS7) as a based for this Python
script in GRASS6.4.. It compiled but I got this error:
make: Entering directory `/home/anrr/Desktop/dwe_devep/r.in.globcover.py'
if [ ! -d /usr/local/grass-6.4.0svn/scripts ]; then mkdir -p
/usr/local/grass-6.4.0svn/scripts; fi
/usr/bin/install -c r.in.globcover.py
/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py
make htmlscript scriptstrings
make[1]: Entering directory `/home/anrr/Desktop/dwe_devep/r.in.globcover.py'
make /usr/local/grass-6.4.0svn/docs/html/r.in.globcover.py.html
HTMLSRC=/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py
make[2]: Entering directory `/home/anrr/Desktop/dwe_devep/r.in.globcover.py'
if [ "/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py" != "" ] ;
then GISRC=/usr/local/grass-6.4.0svn/demolocation/grassrc64
GISBASE=/usr/local/grass-6.4.0svn
PATH="/usr/local/grass-6.4.0svn/bin:$PATH"
LD_LIBRARY_PATH="/usr/local/grass-6.4.0svn/bin:/usr/local/grass-6.4.0svn/lib:"
LC_ALL=C /usr/local/grass-6.4.0svn/scripts/r.in.globcover.py
--html-description < /dev/null | grep -v '</body>\|</html>' >
r.in.globcover.py.tmp.html ; true ; fi
Traceback (most recent call last):
File "/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py", line 50,
in <module>
import grass.script as grass
*ImportError: No module named grass.script*
I thought GRASS6.4 Python's script already had this module. Is not
available?
6.4 has the Python modules, but the build system doesn't support
Python scripts (it doesn't set PYTHONPATH when executing commands).
You will need to modify the definition of htmldesc in
include/Make/Html.make to set PYTHONPATH to include
$(GISBASE)/etc/python (making it work on Windows isn't
straightforward, so I don't expect it to change in 6.x).
Just one last question: How can I retrieve image projection, using a
Python script, with tghe same information-structure I get when I use:
grass.read_command('g.proj', flags = 'jf').strip()
grass.read_command('g.proj', flags = 'jf', georef = filename).strip()
--
Glynn Clements <glynn@gclements.plus.com>
Glynn Clements wrote:
> António Rocha wrote:
>
> >> File "/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py", line 50, in <module>
>> import grass.script as grass
>> *ImportError: No module named grass.script*
>>
>> I thought GRASS6.4 Python's script already had this module. Is not available?
>> >
> 6.4 has the Python modules, but the build system doesn't support
> Python scripts (it doesn't set PYTHONPATH when executing commands).
>
What does this means? That I won't be able to run Python Scripts in 6.4?
> You will need to modify the definition of htmldesc in
> include/Make/Html.make to set PYTHONPATH to include
> $(GISBASE)/etc/python (making it work on Windows isn't
> straightforward, so I don't expect it to change in 6.x).
>
>
This means that now htmldesc becomes this?
htmldesc = \
GISRC=$(RUN_GISRC) \
GISBASE=$(RUN_GISBASE) \
PATH="$(BIN):$$PATH" \
PYTHONPATH= "$(GISBASE)/etc/python" \
$(LD_LIBRARY_PATH_VAR)="$(BIN):$(ARCH_LIBDIR):$($(LD_LIBRARY_PATH_VAR))" \
LC_ALL=C $(1) --html-description < /dev/null | grep -v '</body>\|</html>' > $(PGM).tmp.html ; true
>> Just one last question: How can I retrieve image projection, using a Python script, with tghe same information-structure I get when I use: grass.read_command('g.proj', flags = 'jf').strip()
>> > grass.read_command('g.proj', flags = 'jf', georef = filename).strip()
>
> My first test seems to be fully working. Thanks 
THanks
Best regards,
Antonio
__________ Information from ESET NOD32 Antivirus, version of virus signature database 5216 (20100621) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
António Rocha wrote:
> 6.4 has the Python modules, but the build system doesn't support
> Python scripts (it doesn't set PYTHONPATH when executing commands).
What does this means? That I won't be able to run Python Scripts in 6.4?
You can run a Python script once you've managed to install it, but you
can't just drop it into the source tree, as the 6.x build system
doesn't support Python scripts.
> You will need to modify the definition of htmldesc in
> include/Make/Html.make to set PYTHONPATH to include
> $(GISBASE)/etc/python (making it work on Windows isn't
> straightforward, so I don't expect it to change in 6.x).
This means that now htmldesc becomes this?
htmldesc = \
GISRC=$(RUN_GISRC) \
GISBASE=$(RUN_GISBASE) \
PATH="$(BIN):$$PATH" \
PYTHONPATH= "$(GISBASE)/etc/python" \
$(LD_LIBRARY_PATH_VAR)="$(BIN):$(ARCH_LIBDIR):$($(LD_LIBRARY_PATH_VAR))" \
LC_ALL=C $(1) --html-description < /dev/null | grep -v
'</body>\|</html>' > $(PGM).tmp.html ; true
Other than the formatting, that looks about right for Unix, provided
that PYTHONPATH was empty to start with. For Windows, you need to
convert the path to Windows' syntax.
--
Glynn Clements <glynn@gclements.plus.com>
2010/6/23 Glynn Clements <glynn@gclements.plus.com>:
António Rocha wrote:
> 6.4 has the Python modules, but the build system doesn't support
> Python scripts (it doesn't set PYTHONPATH when executing commands).
What does this means? That I won't be able to run Python Scripts in 6.4?
You can run a Python script once you've managed to install it, but you
can't just drop it into the source tree, as the 6.x build system
doesn't support Python scripts.
what is missing - any pointers?
Markus
Markus Neteler wrote:
>> > 6.4 has the Python modules, but the build system doesn't support
>> > Python scripts (it doesn't set PYTHONPATH when executing commands).
>>
>> What does this means? That I won't be able to run Python Scripts in 6.4?
>
> You can run a Python script once you've managed to install it, but you
> can't just drop it into the source tree, as the 6.x build system
> doesn't support Python scripts.
what is missing - any pointers?
The handling of scripts is entirely different between 6.x and 7.0.
In 6.x, a script is "made" by installing a file of the same name from
the current directory to the scripts directory. On Windows, a
corresponding .bat file is also generated.
In 7.0, the target script has a .py extension on Windows but not on
other platforms. The source script always has a .py suffix. Shell
scripts aren't supported.
If you want to include Python scripts in 6.x, the Makefile would need
to provide the necessary rules; there isn't anything in *.make (in
either 6.x or 7.0) which will help.
--
Glynn Clements <glynn@gclements.plus.com>
On Wed, Jul 28, 2010 at 5:35 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:
Markus Neteler wrote:
>> > 6.4 has the Python modules, but the build system doesn't support
>> > Python scripts (it doesn't set PYTHONPATH when executing commands).
>>
>> What does this means? That I won't be able to run Python Scripts in 6.4?
>
> You can run a Python script once you've managed to install it, but you
> can't just drop it into the source tree, as the 6.x build system
> doesn't support Python scripts.
what is missing - any pointers?
The handling of scripts is entirely different between 6.x and 7.0.
In 6.x, a script is "made" by installing a file of the same name from
the current directory to the scripts directory. On Windows, a
corresponding .bat file is also generated.
In 7.0, the target script has a .py extension on Windows but not on
other platforms. The source script always has a .py suffix. Shell
scripts aren't supported.
If you want to include Python scripts in 6.x, the Makefile would need
to provide the necessary rules; there isn't anything in *.make (in
either 6.x or 7.0) which will help.
I suspect that it would be a clone of
include/Make/Script.make
adapted to Python with a new target
default: python
?,
Markus
Markus Neteler wrote:
> If you want to include Python scripts in 6.x, the Makefile would need
> to provide the necessary rules; there isn't anything in *.make (in
> either 6.x or 7.0) which will help.
I suspect that it would be a clone of
include/Make/Script.make
adapted to Python with a new target
default: python
You would need separate *.make files for shell and Python scripts, and
any given Makefile could only include one of them (otherwise they'll
provide conflicting rules to generate the target).
--
Glynn Clements <glynn@gclements.plus.com>