pokepetter / ursina

A game engine powered by python and panda3d.
https://pokepetter.github.io/ursina/
MIT License
2.17k stars 326 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 0: invalid continuation byte #122

Open vargmurtter opened 3 years ago

vargmurtter commented 3 years ago

Hello! I'm using code example from the documentation, but it throws me with the error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 0: invalid continuation byte

Code:

from ursina import *            # import everything we need with one line.

app = Ursina()
ground = Entity(
    model = 'cube',
    color = color.magenta,
    z = -.1,
    y = -3,
    origin = (0, .5),
    scale = (50, 1, 10),
    collider = 'box'
    )

app.run()                       # opens a window and starts the game.

Windows 10 Home, Python 3.9.1

Full log:

D:\Documents\Python\ursina_engine_test>python main.py
ursina version: 3.3.1
package_folder: C:\Users\VARG MURTTER\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina
asset_folder: .
blender_paths:
{}
screen resolution: (1920, 1080)
Known pipe types:
  wglGraphicsPipe
(3 aux display modules not yet loaded.)
size; LVector2f(1536, 864)
render mode: default
Traceback (most recent call last):
  File "D:\Documents\Python\ursina_engine_test\main.py", line 3, in <module>
    app = Ursina()
  File "C:\Users\VARG MURTTER\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\main.py", line 94, in __init__
    from ursina import gamepad
  File "C:\Users\VARG MURTTER\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\gamepad.py", line 32, in <module>
    base.attachInputDevice(gamepad, prefix=gamepad_name)
  File "C:\Users\VARG MURTTER\AppData\Local\Programs\Python\Python39\lib\site-packages\direct\showbase\ShowBase.py", line 1795, in attachInputDevice
    idn = self.dataRoot.attachNewNode(InputDeviceNode(device, device.name))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 0: invalid continuation byte
QuantumWizard888 commented 2 years ago

Let me guess, you have some gamepad (XBox series controller for example) powered on and you're trying to run this code?

Because I have the same error while my controller is activated. Unless I turn it off.

QuantumWizard888 commented 1 year ago

Found a temporary workaround (in my case this error occurs ONLY when my Xbox Series Gamepad is active): In main.py (inside Ursina package directory), go to line 131 and change this

except e as Exception:

to this

except Exception:

In my case it works and my game runs.