FooSoft/mangle — comment on commit fc8ab5b2168ead7b0b7fd376bbe91d53e21fdc7b
File:  line 0
By Leonidas-from-XIV:

Of course ``__file__`` points to the ``util.py``. Then we get the ``dirname()`` of that to get the directory where the package that contains ``util.py`` is contained. From this, we construct the path to the resource files. Where does it fail for you? Can you please provide a traceback and/or more information? Because I doubt that this is the real problem you ran into.

Using ``sys.argv`` would break the package, as I said, because if I install ``mangle.pyw`` into ``/usr/bin/mangle`` and the package into ``/usr/lib/python2.7/site-packages/mangle`` ``directory = os.path.dirname(sys.argv[0])`` would point to ``/usr/bin`` which is definitely not where one can find the resources.