takluyver / pynsist

Build Windows installers for Python applications
https://pynsist.readthedocs.io/
Other
929 stars 123 forks source link

When launched using relative path, __file__ in the generated launcher is also relative #221

Closed char101 closed 3 years ago

char101 commented 3 years ago

Hi,

I think it is better if __file__ in https://github.com/takluyver/pynsist/blob/9bc2195111f2bd81f7ae223d005279bcfd9730fb/nsist/__init__.py#L237 is wrapped in os.path.abspath() first because in some case, __file__ could contain relative path (e.g. https://github.com/spyder-ide/spyder/issues/14706).

I tried comparing python 3.7 and 3.9, with 3.9 __file__ is always absolute but with 3.7, __file__ is relative if it is run relatively using python script.py.

Thanks.

takluyver commented 3 years ago

In general, there's no guarantee that __file__ is absolute, but I agree it's convenient to make it so where it's easy to do so, and it is easy there. Do you want to make a PR?

char101 commented 3 years ago

The change is trivial so I prefer not to make PR. Thanks.