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

pyxdg: AttributeError: 'MenuEntry' object has no attribute 'Type' on KDE plasma #88593

Closed
mjlbach opened this issue May 22, 2020 · 2 comments · Fixed by #89570
Closed

pyxdg: AttributeError: 'MenuEntry' object has no attribute 'Type' on KDE plasma #88593

mjlbach opened this issue May 22, 2020 · 2 comments · Fixed by #89570

Comments

@mjlbach
Copy link
Contributor

mjlbach commented May 22, 2020

Describe the bug
A clear and concise description of what the bug is.

This came up while debugging xpra on KDE. This issue has been reported upstream, but it seems to uniquely affect KDE on nix. We communicated with the xpra author who added a mitigation for this, but it does not address the underlying issue in pyxdg. It seems the issue is due to the envvar XDG_DATA_DIRS only when it contains both ${plasma-workspace}/share and current-system/sw/share. Those are the only two directories that seem to matter. I'm wondering if this is because some entries from plasma-workspace/share are a subset of what is symlinked into current-system/sw/share?

To Reproduce
Steps to reproduce the behavior:

  1. nix-shell -p "python3.withPackages (ps: with ps; [ pyxdg ])" --command "python -c 'from xdg.Menu import parse;parse()'" -> Error occurs

For the following you'll need the /share directory for the installed KDE. You can get this by echo $XDG_DATA_DIRS > out.txt and searching for plasma-workspace, or on nix repl

❯ sudo nix repl
[sudo] password for mjlbach:
Welcome to Nix version 2.3.4. Type :? for help.

nix-repl> :l <nixpkgs>
Added 11495 variables.

nix-repl> "${plasma-workspace}"
"/nix/store/2gc5fsahhfxvffdrfz2vmr4g2askadia-plasma-workspace-5.17.5"
  1. nix-shell -p "python3.withPackages (ps: with ps; [ pyxdg ])" --command "XDG_DATA_DIRS=/run/current-system/sw/share:/nix/store/2gc5fsahhfxvffdrfz2vmr4g2askadia-plasma-workspace-5.17.5/share python -c 'from xdg.Menu import parse;parse()'" -> Error occurs (change the path to point to your plasma workspace)

  2. nix-shell -p "python3.withPackages (ps: with ps; [ pyxdg ])" --command "XDG_DATA_DIRS=/run/current-system/sw/share python -c 'from xdg.Menu import parse;parse()'" -> Error doesn't occur

  3. nix-shell -p "python3.withPackages (ps: with ps; [ pyxdg ])" --command "XDG_DATA_DIRS=/nix/store/2gc5fsahhfxvffdrfz2vmr4g2askadia-plasma-workspace-5.17.5/share python -c 'from xdg.Menu import parse;parse()'" -> Error doesn't occur

A clear and concise description of what you expected to happen.
pyxdg loads cleanly

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@mjlbach
Copy link
Contributor Author

mjlbach commented Jun 5, 2020

This should be fixed by #89570

mjlbach added a commit to mjlbach/nixpkgs that referenced this issue Jun 6, 2020
Fixes NixOS#88593 by replacing call to missing Type field with getType()
@bbjubjub2494
Copy link
Member

Nixpkgs snippet to make an executable script that tests the issue

writers.writePython3 "pyxdg-test" { libraries = [ python3Packages.pyxdg ]; } ''
from xdg.Menu import parse
parse()
''

bbjubjub2494 pushed a commit to bbjubjub2494/nixpkgs that referenced this issue Jun 8, 2020
Fixes NixOS#88593 by replacing call to missing Type field with getType()

(cherry picked from commit 1968f11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants