Actually it is a bit more complicated than that:
1) make sure gluon is in path
2) then in code:
import gluon.sql
gluon.sql.SQLDB._set_thread_folder('...path...to...databases...
folder...')
db=DAL(...)
... use the db....
db.commit() #or db.rollback()
Notice that you can do:
web2py.py -S youapp -M -R yourscript
Massimo
On Oct 18, 8:24 pm, Mico Siahaan <[email protected]> wrote:
> Hi Sebastian, you need to put gluon in python path.
>
> Regards,
> Mico
>
> On 10/19/09, Sebastian Brandt <[email protected]> wrote:
>
>
>
>
>
> > Hi everyone,
>
> > is it possible to use the web2py modules in a python script?
>
> > I plan to write a script which shall write stuff that is passed to it
> > in a database and I want to use the web2py DAL for that because it is
> > just awesome...
>
> > I tried to import the modules but I get errors that there is no module
> > with that name.
>
> > What would be the correct name for the modules?
>
> > I tried web2py & gluon with no success..
> > .
>
> > Thanks in advance!
> > Sebastian Brandt
>
> --
> Sent from my mobile device
>
> Mico Siahaan
> ---
> Email: [email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---