codelif / touchpad-visualizer

A touchpad visualizer written in python with pygame
0 stars 0 forks source link

TypeError: getoutput() got an unexpected keyword argument 'encoding' #1

Open faveoled opened 6 months ago

faveoled commented 6 months ago

Ubuntu 22.04

$ ./touchme 
Traceback (most recent call last):
  File "/home/user/Dev/Python/touchpad-visualizer/./touchme", line 14, in <module>
    DEVICE = get_touchpad_device()
  File "/home/user/Dev/Python/touchpad-visualizer/libinput.py", line 103, in get_touchpad_device
    libinput_devices(),
  File "/home/user/Dev/Python/touchpad-visualizer/libinput.py", line 77, in libinput_devices
    devices_stdout = subprocess.getoutput(
TypeError: getoutput() got an unexpected keyword argument 'encoding'
codelif commented 6 months ago

Are you in input group? This requires input group privileges. Or you could just run with sudo.

codelif commented 6 months ago

Still, I am not sure why you got this particular error.

Though I never intended for anyone else to use this. But If people are noticing this project I might as well clean it up and add a README.

faveoled commented 6 months ago

Are you in input group?

$ getent group | grep input input:x:107:user

But If people are noticing this project I might as well clean it up and add a README.

I'd wish to have a screenshot

codelif commented 6 months ago

I'd wish to have a screenshot

Of what?

faveoled commented 6 months ago

Of what?

How the app looks

codelif commented 6 months ago

Gimme 5 minutes. Though its pretty barebones.

codelif commented 6 months ago

https://github.com/codelif/touchpad-visualizer/assets/68972644/5585b478-1098-48ad-8107-2aad507e1caa

faveoled commented 6 months ago

Nice. What python version do you use?

codelif commented 6 months ago

3.11.7

codelif commented 6 months ago

I think I got it. The encoding parameter was added in 3.11 for the getoutput function.

I think Ubuntu 22.04 ships with 3.10, so maybe that's the problem. I think a temporary fix would be to just remove that encoding parameter.

I added that because many devices have Chinese characters in their names, so applying a utf-8 encoding would prevent an error.

I didn't know, this was a recently added feature, I try keep my scripts backward compatible. :p

faveoled commented 6 months ago

I think Ubuntu 22.04 ships with 3.10, so maybe that's the problem. I think a temporary fix would be to just remove that encoding parameter.

Got this:

$ ./touchme 
Traceback (most recent call last):
  File "/home/user/Dev/Python/touchpad-visualizer/./touchme", line 14, in <module>
    DEVICE = get_touchpad_device()
  File "/home/user/Dev/Python/touchpad-visualizer/libinput.py", line 103, in get_touchpad_device
    libinput_devices(),
  File "/home/user/Dev/Python/touchpad-visualizer/libinput.py", line 92, in libinput_devices
    devices[devices_index].update({key: value})
IndexError: list index out of range
codelif commented 6 months ago

Could you check the output of the command libinput list-devices?

faveoled commented 6 months ago

Wasn't installed. Installed and now app works fine :+1:

codelif commented 6 months ago

Thanks for trying out. It was really insightful for me.