[GRASS-user] relative path to GISbase in Scripts

Johannes Radinger jradinger at gmx.at
Thu May 12 07:46:10 EDT 2011


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.


/johannes


More information about the grass-user mailing list