Open starsep opened 8 months ago
I can't replicate it locally although in case it becomes relevant, in my case the flatpak is installed as user
, not globally. And Filelock
version in the flatpak package is recent enough. Maybe something is tainting the flatpak environment?
Console logs were more useful than the ones in the dialog:
Exception ignored in: <function BaseFileLock.__del__ at 0x7fdaf608b6a0>
Traceback (most recent call last):
File "/home/starsep/.local/lib/python3.11/site-packages/filelock/_api.py", line 240, in __del__
self.release(force=True)
File "/home/starsep/.local/lib/python3.11/site-packages/filelock/_api.py", line 201, in release
with self._thread_lock:
Based on path it was filelock
package outside of flatpak
Workaround is to disable home directory access via Flatseal. Perhaps setting PYTHONPATH or similar to ensure that site-packages inside flatpak are used would work?
I cannot see why it would load something outside of the flatpak environment unless it is configured in your environment. Your suggestion to unset PYTHONPATH
is valid nonetheless, and Flatseal can do that, but I would like to know exactly what caused it. Could you see what in your environment makes it look for modules in your user's directory?
Restricting access to the user's home folder is not something we can easily do because we need it to access Steam's directories for proton and compatibility tools in general.
Can you please test the build from the flatpak PR above using the link to the test build to see it actually works around the issue? Generally though, Rare's flatpak package is lacking in other areas too.
I tested: Still crashing but I don't think PYTHONPATH
was actually set before.
flatpak run --command=env io.github.dummerle.rare | grep PYTHONPATH
Stable: no results
Test: PYTHONPATH=""
Another suggestion sys.path
?
flatpak run --command=python io.github.dummerle.rare -c "import sys; print(sys.path)"
returns (run from /home/starsep)
Stable:
['', '/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload', '/home/starsep/.local/lib/python3.11/site-packages', '/app/lib/python3.11/site-packages', '/usr/lib/python3.11/site-packages']
Test:
['', '/home/starsep/""', '/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload', '/home/starsep/.local/lib/python3.11/site-packages', '/app/lib/python3.11/site-packages', '/usr/lib/python3.11/site-packages']
So PYTHONPATH
needs to be empty, Not an empty string. Also it is a good idea to set PYTHONSAFEPATH=1
for the flatpak.
In my case, running
flatpak run --command=python io.github.dummerle.rare -c "import sys; print(sys.path)"
produces the following
['', '/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload', '/app/lib/python3.11/site-packages', '/usr/lib/python3.11/site-packages']
and with PYTHONSAFEPATH=1 flatpak ...
['/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload', '/app/lib/python3.11/site-packages', '/usr/lib/python3.11/site-packages']
The other thing I can think of is that you (though installing packages through pip
) or Mint is using a site-specific configuration hook which adds .local/lib/python3.11/site-packages
in sys.path
The last thing is setting PYTHONNOUSERSITE=1
which should stop python from adding your user's site-packages in sys.path
, https://docs.python.org/3/using/cmdline.html#envvar-PYTHONNOUSERSITE
I will add the last one in the flatpak manifest too just to be sure.
https://github.com/flathub/io.github.dummerle.rare/pull/13#issuecomment-1913376806
It works: no crash! Thanks for the help in likely rare (pun intended) bug :)
Now sys.path
returns:
['/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload', '/app/lib/python3.11/site-packages', '/usr/lib/python3.11/site-packages']
Awesome, glad it works now! I will go ahead and keep this open until the flathub PR is is merged for tracking purposes.
Describe the bug
Crash while staring rare freshly installed from flatpak. Relevant code: https://github.com/RareDevs/Rare/blob/59eee7e49c74c69d39911a2ef7ed8135d0873b21/rare/lgndr/lfs/lgndry.py#L11-L12
To Reproduce
Steps to reproduce the behavior:
System information
Please complete the following information
Error message