This is a Python issue and has to do with variable scopes and bytecode compiling -- see http://stackoverflow.com/questions/3571514/python-why-should-from-module-import-be-prohibited. Note, it's only a warning in this case, not an exception (though there are cases where it would raise an exception).
It should only generate the warning within a function, not at the top level in a controller (but outside a function) -- are you observing the latter? Anthony On Monday, March 18, 2013 3:46:24 AM UTC-4, Annet wrote: > > I have a module cms.py with functions that take care of setting validators > on db and labels on form. > In that module I import: > > from gluon.html import * > from gluon.validators import * > > When I import cms.py in db.py: > > from applications.init.modules.cms import* > > I don't get a syntax warning however when I import cms.py at controller > of function level I get the following warning: > > /Users/me/web2py/applications/init/controllers/default.py:68: > SyntaxWarning: import * only allowed at module level > def subscribe(): > > Why can't I import cms.py in a controller or a function? > > > Kind regards, > > Annet > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.