[New-bugs-announce] [issue24396] Provide convenience function for paths relative to the current module
Madison May
report at bugs.python.org
Sat Jun 6 18:47:47 CEST 2015
New submission from Madison May:
I often find myself trying to access a file relative to the module I'm working on. When this occurs, I'll often use something like the following:
```
os.path.abspath(os.path.join(os.path.dirname(__file__), "data/resource.pkl"))
```
I have good reason to believe that I'm not the only one, as searching for other examples of this code on github returns ~20k exact matches: https://github.com/search?utf8=%E2%9C%93&q=%22os.path.abspath%28os.path.join%28os.path.dirname%28__file__%29%22+&type=Code&ref=searchresults
Low priority, but a more concise way of achieving the same result would be much appreciated.
----------
components: Library (Lib)
messages: 244920
nosy: madison.may
priority: normal
severity: normal
status: open
title: Provide convenience function for paths relative to the current module
type: enhancement
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24396>
_______________________________________
More information about the New-bugs-announce
mailing list