Hey,
It took me a few tries before getting this to work. So, I see 2 things
that you may want to try to look at:
1) I don't really use windows, but I think the first line is
problematic. (unless more recent windows versions have gotten smarter
about slashes?).
>>> dbfolder='C:\web2py\web2py\applications\teqb\databases'
>>> db = dal.DAL('sqlite://storage', folder=dbfolder)
should be:
>>> dbfolder='C:/web2py/web2py/applications/teqb/databases'
(or you can escape the back slash (C:\\web2py\\web2py\\...))
2) I remember importing DAL was a little finicky (sometimes). SO, you
may want to try drilling down one more level in you import:
instead of
>>> db = dal.DAL('sqlite://storage', folder=dbfolder)
you may want to try:
from <yourPath>.gluon.dal import DAL
>>> db = DAL('sqlite://storage', folder=dbfolder)
I do the following without any problems on Mac, linux and windows: I
have 2 instances of web2py, some both running on the same machine, so
stand alone is renamed with "blue" prefixes (blueDAL, bluedb,
blueTHIS, blueTHAT, etc. and gluon is renamed to blueSQL in case they
run 2 different versions of web2py, I want to quickly and visually set
them apart when reading script.
tail,head = os.path.split(sys.argv[0])
dataFiles = ["storage.sqlite",
"sql.log"]
dbFolder = "{0}/blueLite/db_storage".format(tail)
try:
for f in os.listdir(dbFolder):
if ".table" in f:
fTable = "{0}/{1}".format(dbFolder,f)
os.remove(fTable)
print("removed {0}".format(fTable))
for dFile in dataFiles:
os.remove("{0}/blueLite/db_storage/{1}".format(tail,dFile))
print("removed {0}/blueLite/db_storage/
{1}".format(tail,dFile))
except Exception as errObj:
print(str(errObj))
from blueLite.pyUtils.sql.blueSQL.dal import DAL as blueDal
from blueLite.pyUtils.sql.blueSQL.dal import SQLField
bluedb = blueDal("sqlite://storage.sqlite", folder="{0}/blueLite/
db_storage".format(tail))
bluedb.define_table('cmdObjects',
SQLField('name'),
SQLField('pyModule'),
SQLField('pyPath'),
SQLField('cmdProperties','blob'),
SQLField('dict_objCmd','blob'),
SQLField('dfo_objCmd', 'blob'),
SQLField('etree_objCmd','blob'))
bluedb.commit()
Then I pass bluedb to all other classes which is why I use the full
path when pointing to the DB folder (NEVER relative).
hope it helps.
Mart :)