问题
Python 3.8.1
using python-arcade and linux manjaro os
This project is a multiplayer game built with python arcade
I get these errors while running :
class Client(arcade.Window):
def __init__(
self,
width: int,
height: int,
title: str = 'Immortals'
) -> None:
super().__init__(width, height, title=title)
Traceback (most recent call last):
File "/home/iddos/Documents/Github/Python/immortals/immortals/main.py", line 42, in <module>
main(**config['resolution'])
File "/home/iddos/Documents/Github/Python/immortals/immortals/main.py", line 20, in main
window = Immortals(*args, **kwargs)
File "/home/iddos/Documents/Github/Python/immortals/immortals/core/client.py", line 40, in __init__
super().__init__(width, height, title=title)
File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/arcade/application.py", line 70, in __init__
super().__init__(width=width, height=height, caption=title,
File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/xlib/__init__.py", line 171, in __init__
super(XlibWindow, self).__init__(*args, **kwargs)
File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/__init__.py", line 642, in __init__
self._create()
File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/arcade/application.py", line 469, in _create
super()._create()
File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/xlib/__init__.py", line 352, in _create
self.set_caption(self._caption)
File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/arcade/application.py", line 481, in set_caption
super().set_caption(caption)
File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/xlib/__init__.py", line 511, in set_caption
self._set_text_property('_NET_WM_NAME', caption)
File "/home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib/python3.8/site-packages/pyglet/window/xlib/__init__.py", line 785, in _set_text_property
raise XlibException('Could not create UTF8 text property')
pyglet.window.xlib.XlibException: Could not create UTF8 text property
And also this ffmpeg not found error, altough ffmpeg is in /usr/bin/ffmpeg
Unable to find match for ffmpeg sound library at expected location: /home/iddos/.local/share/virtualenvs/immortals-SS7Euna6/lib64/python3.8/site-packages/pyglet_ffmpeg2/linux_x86_64/libavfilter.so.7.
I would love to get some help from you guys since i didn't find a solution for this yet.
you can contact me on discord also - F4zi.#1107
回答1:
you are getting pyglet.window.xlib.XlibException: Could not create UTF8 text property
as your locales are not correctly configured. This error comes from the LANG property in the locale.
this can be solved by
in your terminal
- write
LANG=en_US
- Run your python code from the terminal
another solution is to configure the locale for your code by adding this piece of code in the starting of your code(before everything)
import os
os.environ['LANG']='en_US'
回答2:
I solve the issue as follows.
1.Give the commands as follows.
$ sudo locale-gen en_US en_US.UTF-8
2.Select the following in the scrolling menu
en_US.UTF-8
3.Confirm the command
$ sudo locale-gen en_US en_US.UTF-8
4.reboot
$ sudo reboot
Cheers!
来源:https://stackoverflow.com/questions/60141080/pyarcade-pyglet-python3-help-needed