[GRASS-user] using "not so common characters" in Python Script

Greetings

I would like to include some sentences with characters like á ã àó in my grass.message strings. It seems it's not possible Because I get this

    grass.fatal(_('á'))
I get:
  File "C:/local/scripts/x.teste", line 41
SyntaxError: Non-ASCII character '\xe1' in file
C:/local/scripts/x.teste on line 41, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for
details

Is it possible?
Thanks
Antonio Rocha

__________ Information from ESET NOD32 Antivirus, version of virus signature database 6132 (20110518) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Hi António

I usually start all my python scripts with the following two lines:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

The first line is nice for linux users. The second line ensures that I
can write non-ASCII characters in my code.
In your case, just add this second line to your script and make sure
it is either the first or second line of the script.
I recommend adding both lines to the top of the file, as a good practice.

If you'd like to know more just check out the link that the grass
error is giving you.

Cheers

2011/5/18 António Rocha <antonio.rocha@deimos.com.pt>:

Greetings
I would like to include some sentences with characters like á ã àó in my
grass.message strings. It seems it's not possible Because I get this

grass.fatal(_('á'))
I get:
File "C:/local/scripts/x.teste", line 41
SyntaxError: Non-ASCII character '\xe1' in file
C:/local/scripts/x.teste on line 41, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for
details

Is it possible?
Thanks
Antonio Rocha

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 6132 (20110518) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

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

--
___________________________ ___ __
Ricardo Garcia Silva