no, please do not use exec_environment. from gluon import DAL db = DAL('sqlite://....',folder='/your/app/ databases',auto_import=True)
print db.tables On Jun 3, 9:27 am, "j...@qlf.com" <j...@qlf.com> wrote: > Hi > > Just starting with web2py. I've been using TurboGears (w/ SQLObject) for > many years and am excited about the things that web2py has to offer. On to > my question... > > I have a need to use the DAL outside of web2py. I found the following in the > manual... > > from gluon.shell import exec_environment > cas = exec_environment('applications/cas/models/db.py') > rows = cas.db().select(cas.db.user.ALL) > > I've modified it a bit and came up with... > > import sys > > sys.path.append('w:/web2py/library.zip') > > from gluon.shell import exec_environment > > ic = exec_environment('/applications/InfoCenter/models/db.py') > > rows = ic.db().select(ic.db.auth_user.ALL) > > for row in rows: > > print row > > ...but am getting the following: > > Traceback (most recent call last): > > File "C:/dev/miscellaneous/playground/dalOutside.py", line 4, in <module> > > ic = exec_environment('/applications/InfoCenter/models/db.py') > > File "gluon/shell.py", line 60, in exec_environment > > File "gluon/compileapp.py", line 230, in build_environment > > File "gluon/cache.py", line 371, in __init__ > > File "gluon/cache.py", line 229, in __init__ > > WindowsError: [Error 3] The system cannot find the path specified: > 'applications\\InfoCenter\\cache' > > Any clues to what I should be looking at? > > Thanks! > > -Jim