On Jan 8, 10:14 am, mk <[email protected]> wrote:
> Wyatt Baldwin wrote:
>
> > To get access to `h` in a controller:
>
> >     from pylons import config
> >     h = config['pylons.h']
>
> > See config/environment.py for where `config['pylons.h']` is
> > configured. By default, it points at the <yourapp>.lib.helpers module,
> > so you could also get `h` in a controller like this:
>
> >     import <yourapp>.lib.helpers as h
>
> I'm getting errors:
>
>      def dirh(self):
>          import HelloWorld.lib.helpers as h
>          msg = str(dir(h))
>          return msg
>
> ImportError: No module named HelloWorld.lib.helpers
>
> The second method works though.

You need to import the package, not the class:
import helloworld.lib.helpers as h
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to