Massimo, thanks for your answer. I upgraded just yesterday to 1.96.x.
I am getting the following:
> cat applications/app/tests/a.py
print __file__
Traceback (most recent call last):
File "web2py.py", line 19, in <module>
gluon.widget.start(cron=True)
File "/home/.../web2py/gluon/widget.py", line 808, in start
import_models=options.import_models, startfile=options.run)
File "/home/.../web2py/gluon/shell.py", line 200, in run
execfile(startfile, _env)
File "applications/app/tests/a.py", line 1, in <module>
print __file__
NameError: global name '__file__' is not defined
On Jun 21, 10:11 pm, Massimo Di Pierro <[email protected]>
wrote:
> which web2py version? The latest version should allow __file__ in
> shell executed files.
>
> On Jun 21, 6:04 am, amit <[email protected]> wrote:
>
>
>
>
>
>
>
> > I have 2 modules a.py and b.py inside applications/app/tests directory
> > and am trying to import b.py from a.py. I find it not easy as I am
> > calling a.py using web2py shell, which disallows the usage of __file__
> > (otherwise I could append the tests directory to sys.path).
>
> > python web2py.py -S app -R applications/app/tests/a.py