[GRASS-user] Re: [GRASS-dev] Helpp needed to call Grass from inside Python Plugin

Bishwarup Banerjee bishwarup.banerjee at gmail.com
Thu Mar 25 03:36:50 EDT 2010


Dear All,

Thank you very much for all your inputs and you guys have done a wonderful
work.
I am able to solve my problem.
Three Cheers for Grass and Open Source Softwares.
Thanks you all once again.

With Regards,
Bishwarup

On Thu, Mar 25, 2010 at 7:50 AM, Glynn Clements <glynn at gclements.plus.com>wrote:

>
> Bishwarup Banerjee wrote:
>
> > I have tried to iimplement the example in my way. The code is as follows
>
> > import core as grass
>
> This should be:
>
>        import grass.script as grass
> or:
>        import grass.script.core as grass
>
> > def main():
> >     input_map = options['H:/Shared_data/test1.tif']
> >     output_map = options['Test_24']
>
> This is bogus. The keys in the "options" dictionary are the names of
> the options defined in the g.parser comments (assuming that you have
> them; if you don't, grass.parser() won't work).
>
> > But I get the following error, I cant make out where I am going wrong. I
> > have set all the Env variables as suggested in the wiki page. Please help
> me
> > to implement it.
> >
> >
> > F:\GRASS-6-SVN\etc\python\grass\script>python test.py
> > Traceback (most recent call last):
> >   File "test.py", line 18, in <module>
> >     options, flags = grass.parser()
> >   File "F:\GRASS-6-SVN\etc\python\grass\script\core.py", line 359, in
> parser
> >     os.execvp("g.parser.exe", [name] + argv)
> >   File "F:\Quantum GIS\python\os.py", line 353, in execvp
> >     _execvpe(file, args)
> >   File "F:\Quantum GIS\python\os.py", line 389, in _execvpe
> >     func(fullname, *argrest)
> > OSError: [Errno 22] Invalid argument
>
> I have no idea what's causing this.
>
> I suggest modifying the parser() function to print the arguments which
> are being passed to os.execvp():
>
> >   File "F:\GRASS-6-SVN\etc\python\grass\script\core.py", line 359, in
> parser
> >     os.execvp("g.parser.exe", [name] + argv)
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100325/0f590e52/attachment.html


More information about the grass-user mailing list