[GRASS-user] relative path to GISbase in Scripts

Markus Neteler neteler at osgeo.org
Fri May 13 09:40:48 EDT 2011


On Thu, May 12, 2011 at 1:46 PM, Johannes Radinger <jradinger at gmx.at> wrote:
> Hello,
>
> at the moment I am connecting to the sqlite database with the use of a absolute path in a pythonscript like:
>
> database = sqlite3.connect('/users/Johannes Radinger/Documents/GRASS-GIS/Treene_location/Treene/sqlite.db')
> db = database.cursor()
>
> I think it should be possible to set a relative Path in pyton like
>
> database = sqlite3.connect('$relative/$path/$to/$location/sqlite.db') but how can that be done?
> It is just because I want to use my script in different location and don't want to change the path each time.

I think that the variable GISDBASE should work. There may be a Python
function to
read it.

Markus


More information about the grass-user mailing list