Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 'bytes' object has no attribute 'suffix'. on xkalamine install #163

Open
Da-Va opened this issue Mar 14, 2024 · 5 comments
Open

Error: 'bytes' object has no attribute 'suffix'. on xkalamine install #163

Da-Va opened this issue Mar 14, 2024 · 5 comments
Labels
bug Something isn't working linux

Comments

@Da-Va
Copy link

Da-Va commented Mar 14, 2024

I have upgraded to kalamine v0.36.
I used the 1dk keyboard layouts before without an issue.

Now I build my own layout, but when trying to install it using the

sudo env "PATH=$PATH" xkalamine install <path/to/layout>.toml

I get the following cryptic error

File could not be parsed.
Error: 'bytes' object has no attribute 'suffix'.

The .toml file is valid. I can use xkalamine apply to use it ad-hoc and I can test the layout using kalamine watch.

I am on Ubuntu 20.04 LTS.

@fabi1cazenave
Copy link
Collaborator

Strange, I can’t reproduce this error here (with Ubuntu 22.04). Could you please :

  • share the whole console output, from the command line to the next prompt
  • share your TOML file

@Da-Va
Copy link
Author

Da-Va commented Mar 15, 2024

This is the whole output after the prompt:

$ sudo env "PATH=$PATH" xkalamine install <path/to/layout>.toml
File could not be parsed.
Error: 'bytes' object has no attribute 'suffix'.

It appears to be an issue with the parser, not Kalamine.

Since creating the issue, I downgraded Kalamine to 0.13 and it works.
It could be some broken Python dependencies on my side.
I do robotics research and have ROS Noetic installed; and ROS is a packaging nightmare, so this could indeed be a rare bug that only affects me, and it may be outside of your control.

I attach the layout file (it has .txt suffix since GitHub does not let me to attach a .toml file.

layout.txt

@wismill
Copy link
Collaborator

wismill commented Mar 15, 2024

It could be some broken Python dependencies on my side.
I do robotics research and have ROS Noetic installed; and ROS is a packaging nightmare, so this could indeed be a rare bug that only affects me, and it may be outside of your control.

How did you install kalamine? The recommend method is using pipx. See the README, which isolate dependencies. If not, give it a try after deinstalling your previous installation of kalamine.

What Python version are you using? The bytes error is suspiciously a common Python 2 error.

python --version

@fabi1cazenave
Copy link
Collaborator

I agree the pipx trick would make it much easier to run xkalamine with sudo.

It appears to be an issue with the parser, not Kalamine.

This is weird : if the parser didn’t work, then kalamine watch wouldn’t work either.

I’m tempted to think this might be something related to sudo. Can you please try kalamine install without sudo to see if the parser works in this context ?

This won’t install your layout, but as xkalamine parses the layout before trying to install it, we’ll know whether this is related to the parser or to the sudo / python environment.

The bytes error is suspiciously a common Python 2 error.

Oh, I didn’t know that. The Python2 trick would surprise me a bit, as all cli*.py files have a Python3 shebang :

#!/usr/bin/env python3

However, I did drop those Python3 shebangs in non-script modules in #105. If that’s related, then version 0.22 should work and version 0.33 should not.

@PatrickMassot
Copy link
Contributor

I can confirm the issue on a new machine. Downgrading kalamine to 0.22 fixed it.

@trilowy trilowy added bug Something isn't working linux labels Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linux
Projects
None yet
Development

No branches or pull requests

5 participants