Thanks much for the info. Being new to web2py I don't have a feel for how
things happen in the community. I just purchased/printed the book/manual and
found this recipe under Core | Execution Environment. I know that I'm using a
brand new release. How often do you update the manual? Are there other
resources I should be looking at to get started?
Not complaining at all, loving the capabilities of the tool and the fact that
it is documented at all.
-Jim
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of
Massimo Di Pierro
Sent: Friday, June 03, 2011 10:29 AM
To: web2py-users
Subject: [web2py] Re: Noob - Using DAL outside of web2py
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, "[email protected]" <[email protected]> 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