I never really got messed up with Python. Several months ago I had to
give up due to lack of free time. Now, I am trying to move on but I have
no idea on how solve the following "db.execute" problem:
# basic info about the point vector/ db
driver = 'sqlite'
database = '/geo/grassdb/peloponnese/evaluation_utm/PERMANENT/sqlite.db'
# note: I am running python from within grass from within a
user-mapset (not PERMANENT)
Nikos wrote:
> grass.write_command('db.execute', input = '-', stdin = sql_coi_percent,
> database = database, driver = driver)
> -: No such file or directory
'db.execute input=-' for stdin only works in grass7. for 6.4+6.5 it is
simpler, just omit the input option all together.
Hmm... ok, thank you.
Scripting (or better said learning how to) can be very exciting but
changes (like the above) that break stuff are tough and can be
frustrating.
I read the other day that Python3 will introduce some changes. At what
extent will be os-geo stuff, and especially grass, affected? How should
an average scripter behave? How to prepare scripts that are ready for
changes?
I read the other day that Python3 will introduce some changes. At what
extent will be os-geo stuff, and especially grass, affected? How should
an average scripter behave? How to prepare scripts that are ready for
changes?
The most fundamental change is that Python3's default string type is
Unicode; if you want byte strings, you have to specifically request
them (or in some cases, explicitly convert from Unicode, as is the
case with sys.argv and os.environ).
Needless to say, this doesn't interact well with Unix-style scripting,
where everything is byte strings. Expect to have to add a lot of
explict conversions between Unicode strings and byte strings.
OTOH, the change is sufficiently fundamental that you can expect the
2.x series to be maintained for the foreseeable future (even if Guido
abandons 2.x, someone else will maintain it).