It's important to differentiate between your configuration and your
package. The %(here)s in your ini file is config-relative meaning it has
nothing to do with where your package is located. Your ini file, in
general, can be anywhere. If you want something that is package-relative
then the pkg_resources apis are the best way to go.


On Mon, Apr 21, 2014 at 11:24 AM, Winston Ferreira <[email protected]>wrote:

> I would use this:
> >>> from pkg_resources import resource_filename
> >>> resource_filename('zope.interface', '')
> '/location/to/env/zope.interface-4.1.0-py2.7-linux-i686.egg/zope/interface'
> >>>
>
>
> 2014-04-21 13:20 GMT-03:00, Chris Rossi <[email protected]>:
> > The answer possibly depends on why you want to know the path and what you
> > want to do with it.
> >
> > Chris
> >
> >
> > On Mon, Apr 21, 2014 at 12:11 PM, Seth <[email protected]> wrote:
> >
> >> What's the "proper" way of getting the abspath for my Pyramid project?
> >> Obviously I could set a "%(here)s" config in one of the .inis or use an
> >> os.path.abspath(os.path.dirname(__file__)) call in my __init__.py, but I
> >> was wondering if there was a more "Pyramidic" way of doing this that
> >> works
> >> pretty much anywhere?
> >>
> >> Thanks,
> >> Seth
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "pylons-discuss" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to [email protected].
> >> To post to this group, send email to [email protected].
> >> Visit this group at http://groups.google.com/group/pylons-discuss.
> >> For more options, visit https://groups.google.com/d/optout.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "pylons-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group at http://groups.google.com/group/pylons-discuss.
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to