tf2-discord
tf2-discord copied to clipboard
Service fails to start
So I am on Manjaro, done everything as guide said but when I do systemctl status tf2richpresence --user it shows
[rafii2198@Rafii-Manjaro tf2disc-linux]$ systemctl status tf2richpresence --user
● tf2richpresence.service - TF2 Rich Presence
Loaded: loaded (/usr/lib/systemd/user/tf2richpresence.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021-03-16 21:45:25 CET; 3s ago
Process: 27496 ExecStart=/usr/share/tf2-rich-presence/tf2-discord (code=exited, status=1/FAILURE)
Main PID: 27496 (code=exited, status=1/FAILURE)
mar 16 21:45:25 Rafii-Manjaro tf2-discord[27496]: '/usr/lib/python3.8',
mar 16 21:45:25 Rafii-Manjaro tf2-discord[27496]: '/usr/lib/lib-dynload',
mar 16 21:45:25 Rafii-Manjaro tf2-discord[27496]: ]
mar 16 21:45:25 Rafii-Manjaro tf2-discord[27496]: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesyste>
mar 16 21:45:25 Rafii-Manjaro tf2-discord[27496]: Python runtime state: core initialized
mar 16 21:45:25 Rafii-Manjaro tf2-discord[27496]: ModuleNotFoundError: No module named 'encodings'
mar 16 21:45:25 Rafii-Manjaro tf2-discord[27496]: Current thread 0x00007f9b5c342740 (most recent call first):
mar 16 21:45:25 Rafii-Manjaro tf2-discord[27496]: <no Python frame>
mar 16 21:45:25 Rafii-Manjaro systemd[1465]: tf2richpresence.service: Main process exited, code=exited, status=1/FAILURE
mar 16 21:45:25 Rafii-Manjaro systemd[1465]: tf2richpresence.service: Failed with result 'exit-code'.
I don't know much about Python, but it sounds like it couldn't find a module, maybe perhaps I need to download something?
did you install using the release or build manually?
I used Release version 4.0.0
Same error, Using Arch
now this is a weird, cause I believe there is no python module called encodings even tho the error here is ModuleNotFoundError: No module named 'encodings' this I believe
and neither in the program's code is a mention to encodings, must be some weird dependency bug?
The weird thing is that I remember that I got this working fine but this was before I had to reinstall my OS which was almost a year ago and I totally cant remember what I did to fix the issue... and I can't even remember if it was the same issue or not...
yeah ngl i do not understand this error at all but i'm planning to essentially rewrite this program soonish so hopefully that will fix it
https://stackoverflow.com/questions/5694706/py-initialize-fails-unable-to-load-the-file-system-codec https://discuss.python.org/t/fatal-python-error-init-fs-encoding-failed-to-get-the-python-codec-of-the-filesystem-encoding/3173 related issues, check your PYTHONHOME and PYTHONPATH env vars and see if they point to py2.x instead of py3.x (i dont know why this would matter because its frozen but who knows)
@Rafii2198 @alou-S
Ok so PYTHONPATH has folders with 3.9 version.
I tried to build it manually and it got wierder, first of all I unistalled the github build but the uninstall_linux.sh had error on line 8, besically I had to change [ $cont == "y" ] to [ $cont="y" ] for it to work, then while I was building I noticed the python script go error and thus didn't provide tf2-discord file as I assume it would. The error
/usr/lib/python3.9/site-packages/cx_Freeze/common.py:128: UserWarning: camelCase values is obsolete and will be removed in the next major version -> use the new name 'target_name'
warnings.warn(
running build
running build_exe
Traceback (most recent call last):
File "/run/media/rafii2198/HDD/temp/tf2-discord/dist/setup.pyw", line 16, in <module>
setup( name="tf2-discord",
File "/usr/lib/python3.9/site-packages/cx_Freeze/dist.py", line 397, in setup
distutils.core.setup(**attrs)
File "/usr/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.9/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.9/site-packages/cx_Freeze/dist.py", line 239, in run
freezer = Freezer(
File "/usr/lib/python3.9/site-packages/cx_Freeze/freezer.py", line 88, in __init__
self._VerifyConfiguration()
File "/usr/lib/python3.9/site-packages/cx_Freeze/freezer.py", line 551, in _VerifyConfiguration
self.patchelf = Patchelf()
File "/usr/lib/python3.9/site-packages/cx_Freeze/patchelf.py", line 15, in __init__
_verify_patchelf()
File "/usr/lib/python3.9/site-packages/cx_Freeze/patchelf.py", line 52, in _verify_patchelf
raise ValueError("Cannot find required utility `patchelf` in PATH")
ValueError: Cannot find required utility `patchelf` in PATH
Is it the problem with cxfreeze? Cause I installed it too with pacman -S python-cx-freeze...
i got that as well earlier, its a bug with cxfreeze
https://bugs.archlinux.org/task/70560
you need to install patchelf (should just be pacman -S patchelf?)
I installed it but got multiple errors about ImportError: No module named XXX I decided to just type that name that was under XXX into pip install and it worked but I got stuck with this one
[rafii2198@Rafii-Manjaro dist]$ python setup.pyw build
/usr/lib/python3.9/site-packages/cx_Freeze/common.py:128: UserWarning: camelCase values is obsolete and will be removed in the next major version -> use the new name 'target_name'
warnings.warn(
running build
running build_exe
Traceback (most recent call last):
File "/run/media/rafii2198/HDD/temp/tf2-discord/dist/setup.pyw", line 16, in <module>
setup( name="tf2-discord",
File "/usr/lib/python3.9/site-packages/cx_Freeze/dist.py", line 397, in setup
distutils.core.setup(**attrs)
File "/usr/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.9/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.9/site-packages/cx_Freeze/dist.py", line 265, in run
freezer.Freeze()
File "/usr/lib/python3.9/site-packages/cx_Freeze/freezer.py", line 795, in Freeze
self.finder: ModuleFinder = self._GetModuleFinder()
File "/usr/lib/python3.9/site-packages/cx_Freeze/freezer.py", line 479, in _GetModuleFinder
finder.IncludePackage(name)
File "/usr/lib/python3.9/site-packages/cx_Freeze/finder.py", line 685, in IncludePackage
module = self._import_module(name, deferred_imports)
File "/usr/lib/python3.9/site-packages/cx_Freeze/finder.py", line 296, in _import_module
raise ImportError(f"No module named {name!r}")
ImportError: No module named 'errors'
So far I had to install: presence, config and parsing.
I installed it but got multiple errors about
ImportError: No module named XXXI decided to just type that name that was under XXX into pip install and it worked but I got stuck with this one
So far I had to install: presence, config and parsing.
those are the modules i wrote internally, you shouldn't have to pip install them; wonder why its not working with cxfreeze, never had that happen before
Well as I said I don't know much about Python. But I noticed that these errors I just got sounds similar to the very first error here which was ModuleNotFoundError: No module named 'encodings' is there maybe a connection between these errors?
ill chalk this one up to "trying to distribute a cross-platform python application to people who might not have python installed is hell"
cxfreeze is probably bugging out somehow about not including the right modules
Just wanna say I had the OP's error in my systemctl log and I got around it but installing AUR package "python38" and restarting the service, ~~runs perfectly now~~
Edit: Just kidding it crashed after entering a game now
Sep 24 15:23:20 omnius tf2-discord[40091]: File "main.py", line 108, in run Sep 24 15:23:20 omnius tf2-discord[40091]: File "main.py", line 52, in query_server Sep 24 15:23:20 omnius tf2-discord[40091]: File "/home/hyacinth/.local/lib/python3.8/site-packages/valve/source/a2s.py", line 140, in info Sep 24 15:23:20 omnius tf2-discord[40091]: File "/home/hyacinth/.local/lib/python3.8/site-packages/valve/source/messages.py", line 415, in decode Sep 24 15:23:20 omnius tf2-discord[40091]: File "/home/hyacinth/.local/lib/python3.8/site-packages/valve/source/messages.py", line 41, in needs_buffer Sep 24 15:23:20 omnius tf2-discord[40091]: File "/home/hyacinth/.local/lib/python3.8/site-packages/valve/source/messages.py", line 130, in decode Sep 24 15:23:20 omnius tf2-discord[40091]: File "/home/hyacinth/.local/lib/python3.8/site-packages/valve/source/messages.py", line 93, in validate Sep 24 15:23:20 omnius tf2-discord[40091]: valve.source.messages.BrokenMessageError: Invalid value (65) for field 'response_type' Sep 24 15:23:20 omnius systemd[1657]: tf2richpresence.service: Main process exited, code=exited, status=1/FAILURE Sep 24 15:23:20 omnius systemd[1657]: tf2richpresence.service: Failed with result 'exit-code'.
Having same issue here on Arch with ModuleNotFoundError: No module named 'encodings'