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

Enable use with both available python XDG modules #142

Closed
wants to merge 1 commit into from

Conversation

markk
Copy link
Contributor

@markk markk commented Oct 9, 2021

There are currently two python modules implementing the freedesktop.org
standards, PyXDG https://freedesktop.org/wiki/Software/pyxdg/ and xdg
https://github.com/srstevenson/xdg. Unfortunately both are imported under the
namespace xdg.

This patch enables either module to be used to return the required directory
paths.

There are currently two python modules implementing the freedesktop.org
standards, PyXDG https://freedesktop.org/wiki/Software/pyxdg/ and xdg
https://github.com/srstevenson/xdg. Unfortunately both are imported under the
namespace `xdg`.

This patch enables either module to be used to return the required directory
paths.
Copy link
Member

@dsheeler dsheeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually doesn't work for me in the case of only having pyxdg installed. I get this:

$ jack_mixer
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/jack_mixer/gui.py", line 29, in <module>
    confdir = xdg.XDG_CONFIG_HOME / "jack_mixer"
AttributeError: module 'xdg' has no attribute 'XDG_CONFIG_HOME'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/jack_mixer", line 5, in <module>
    from jack_mixer.app import main
  File "/usr/lib/python3.9/site-packages/jack_mixer/app.py", line 27, in <module>
    from . import gui
  File "/usr/lib/python3.9/site-packages/jack_mixer/gui.py", line 32, in <module>
    confdir = xdg.BaseDirectory.save_config_path("jack_mixer")
AttributeError: module 'xdg' has no attribute 'BaseDirectory'

I noticed BaseDirectory is not exported at the top level or something weird. It works if you do from xdg import BaseDirectory and use it as BaseDirectory. Can't say I understand why!

@SpotlightKid
Copy link
Contributor

We should pyxdg anyway with something like appdirs (see comment here #112 (comment)).

Given that, I don't think this PR is useful.

@markk Thanks for your interest in jack_mixer and your work nevertheless. A PR replacing pyxdg with something cross-platform would have a better chance of being accepted.

@dsheeler
Copy link
Member

appdirs looks like a winner to me. @markk, ditto on the thanks for working on jack_mixer!

@markk
Copy link
Contributor Author

markk commented Oct 20, 2021

Thanks. I've made a new pull request #149 for the appdirs module.

@markk markk closed this Oct 20, 2021
@markk markk deleted the xdg branch October 20, 2021 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants