it's not "hacky". it's normal for whatever module is not yet on sys.path.
if you want to import something from whatever.py, you need to have it on
sys.path to be able to do "from whatever import something" (in your case
import gluon.dal is equivalent)
so, you have 3 main ways:
- start python in the web2py folder (the cwd gets appended to sys.path
automatically)
- use sys.path.append('the_path_where_dal_is')
- start python in a folder that contains a folder named gluon, with dal.py
and __init__.py inside
On Monday, January 28, 2013 1:25:23 PM UTC+1, Alec Taylor wrote:
>
> Thanks, but is there a non-hacky solution?
>
> On Mon, Jan 28, 2013 at 6:55 PM, Emilius Omeen <[email protected] <javascript:>>
> wrote:
> > import sys
> > sys.path.append('/home/www-data/web2py')
> > from gluon import DAL, Field
> >
> > --
> >
> >
> >
>
--