[Python-ideas] os.path.here()
Oscar Benjamin
oscar.j.benjamin at gmail.com
Wed Feb 19 18:04:47 CET 2014
More information about the Python-ideas mailing list
Wed Feb 19 18:04:47 CET 2014
- Previous message: [Python-ideas] os.path.here()
- Next message: [Python-ideas] os.path.here()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 19 February 2014 16:52, Giampaolo Rodola' <g.rodola at gmail.com> wrote: > > The implementation is pretty straightforward: > > def here(concat=None): > """Return the absolute path of the parent directory where the > script is defined. > """ > here = os.path.abspath(os.path.dirname(__file__)) > if concat is not None: > here = os.path.abspath(os.path.join(here, concat)) > return here So if I do from os.path import here and get the above function what happens when I call it in another module? > Thoughts? This encourages writing code that makes assumptions that break when run from a zip file. I think that encouraging pkgutil.get_data() for loading resources that are stored adjacent to a module is better. Oscar
- Previous message: [Python-ideas] os.path.here()
- Next message: [Python-ideas] os.path.here()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list