python - Creating database file one directory above current -


in php, refer higher directory use '../../test'; how in python?

in case, i'm using sqlite create database file.

import sqlite3 conn = sqlite3.connect('../data/test.db') 

however; says 'unable open database file' i'm considering directory access error. how refer higher directory in python?

you might try this:

conn = sqlite3.connect(os.path.realpath('../data/test.db')) 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -