[GRASS-user] i.maxlik

Hello,

I am running i.maxlik in python - attempting to automate a processing chain.
I use the command:

grass.run_command(‘i.maxlik’, group= group, subgroup=subgroup, class=‘classification’, sigfile = sigfile, verbose = True)

Infuriatingly, however ‘class’ is a python keyword and it doesn’t run due to ‘invalid syntax’.

Would you know a way to work around this?

Regards

Becky

On Wed, Feb 13, 2013 at 10:50 AM, Margherita Di Leo <diregola@gmail.com> wrote:

Hi,

On Wed, Feb 13, 2013 at 10:36 AM, Rebecca Stedham <rlstedham@btinternet.com> wrote:

Hello,

I am running i.maxlik in python - attempting to automate a processing chain.
I use the command:

grass.run_command(‘i.maxlik’, group= group, subgroup=subgroup, class=‘classification’, sigfile = sigfile, verbose = True)

Infuriatingly, however ‘class’ is a python keyword and it doesn’t run due to ‘invalid syntax’.

Would you know a way to work around this?

yes there is a workaround, although not recommended, more or less sounds like:

import os

os.system(“i.maxlik group=group subgroup=subgroup class’classification’ sigfile=sigfile --v”)

BTW I would suggest to report the issue in the trac, in order to prevent the use of reserved python keywords in the modules.

Thanks,
madi

Regards

Becky


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

Margherita DI LEO
Postdoctoral Researcher

European Commission - DG JRC
Institute for Environment and Sustainability (IES). Unit H03 – FRC
Via Fermi, 2749
I-21027 Ispra (VA) - Italy - TP 261

Tel. +39 0332 78 3600
margherita.di-leo@jrc.ec.europa.eu

Disclaimer: The views expressed are purely those of the writer and may not in any circumstance be regarded as stating an official position of the European Commission.

Margherita DI LEO
Postdoctoral Researcher

European Commission - DG JRC
Institute for Environment and Sustainability (IES). Unit H03 – FRC
Via Fermi, 2749
I-21027 Ispra (VA) - Italy - TP 261

Tel. +39 0332 78 3600
margherita.di-leo@jrc.ec.europa.eu

Disclaimer: The views expressed are purely those of the writer and may not in any circumstance be regarded as stating an official position of the European Commission.

Hi

On Wed, Feb 13, 2013 at 10:36 AM, Rebecca Stedham
<rlstedham@btinternet.com> wrote:

Hello,

I am running i.maxlik in python - attempting to automate a processing chain.
I use the command:

grass.run_command('i.maxlik', group= group, subgroup=subgroup,
class='classification', sigfile = sigfile, verbose = True)

Infuriatingly, however 'class' is a python keyword and it doesn't run due to
'invalid syntax'.

I had a similar issue with v.distance which uses 'from', another python keyword.
Here the pythoncode is '_from' which looks like:
grass.run_command("v.distance",_from="xxx",to="xxx",...)

Maybe there is something similar for class ('_class'?) in i.maxlik.

/johannes

Would you know a way to work around this?

Regards

Becky

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

On Wed, Feb 13, 2013 at 12:27 PM, Johannes Radinger
<johannesradinger@gmail.com> wrote:

Hi

On Wed, Feb 13, 2013 at 10:36 AM, Rebecca Stedham
<rlstedham@btinternet.com> wrote:

Hello,

I am running i.maxlik in python - attempting to automate a processing chain.
I use the command:

grass.run_command('i.maxlik', group= group, subgroup=subgroup,
class='classification', sigfile = sigfile, verbose = True)

Infuriatingly, however 'class' is a python keyword and it doesn't run due to
'invalid syntax'.

I had a similar issue with v.distance which uses 'from', another python keyword.
Here the pythoncode is '_from' which looks like:
grass.run_command("v.distance",_from="xxx",to="xxx",...)

Maybe there is something similar for class ('_class'?) in i.maxlik.

Here a solution was suggested:

http://gis.stackexchange.com/questions/50753/is-there-a-workaround-for-grass-i-maxlik-class-being-a-keyword-in-python

Discussion to be continued in the grass-dev list, I have already
posted there.

Markus