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

ValueError: Path is not a bytestring #1744

Closed
weilbith opened this issue Feb 12, 2019 · 12 comments
Closed

ValueError: Path is not a bytestring #1744

weilbith opened this issue Feb 12, 2019 · 12 comments
Labels
Milestone

Comments

@weilbith
Copy link

@weilbith weilbith commented Feb 12, 2019

I just installed Mopidy by the Arch package. Using this minimal configuration, the check with mopidy config fails with the following error:

[core]
cache_dir = $XDG_CACHE_HOME/mopidy
/usr/lib/python2.7/site-packages/mopidy/ext.py:202: PkgResourcesDeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.
  extension_class = entry_point.load(require=False)
Traceback (most recent call last):
  File "/usr/bin/mopidy", line 11, in <module>
    load_entry_point('Mopidy==2.2.2', 'console_scripts', 'mopidy')()
  File "/usr/lib/python2.7/site-packages/mopidy/__main__.py", line 61, in main
    create_core_dirs(config)
  File "/usr/lib/python2.7/site-packages/mopidy/__main__.py", line 147, in create_core_dirs
    path.get_or_create_dir(config['core']['cache_dir'])
  File "/usr/lib/python2.7/site-packages/mopidy/internal/path.py", line 23, in get_or_create_dir
    raise ValueError('Path is not a bytestring.')
ValueError: Path is not a bytestring.

I found this issue which seems to be somehow related. But it has been fixed and the commit is merged into master as I checked it. Also the last build of the package is after this fix has been merged, so I would expect it to be included.

When I replace the environment variable with its value, the check goes through and mopidy config displays the correct path. But I would rly prefer to use variables as everywhere used in the documentation.

Thanks for your help!

@jakubfijalkowski

This comment has been minimized.

Copy link

@jakubfijalkowski jakubfijalkowski commented Mar 14, 2019

I've just had similar problem. Use XDG_CACHE_DIR instead of XDG_CACHE_HOME. Mopidy does translate XDG_CONFIG_HOME, XDG_CACHE_HOME and XDG_DATA_HOME to *_DIR variables and AFAIK does not allow direct access to env variables.

@weilbith

This comment has been minimized.

Copy link
Author

@weilbith weilbith commented Mar 21, 2019

Introducing the usage of os.path.expandvars shouldn't be hard. Are you open for a PR? 🤔

@jakubfijalkowski

This comment has been minimized.

Copy link

@jakubfijalkowski jakubfijalkowski commented Mar 26, 2019

I would gladly accept it but that would be a breaking change and I don't think this is worth the fuss (but I'm not a maintainer, so...).

@weilbith

This comment has been minimized.

Copy link
Author

@weilbith weilbith commented Mar 26, 2019

Why do you think this is a breaking change? 😲
I mean it would do nothing for any normal path as before, just environment variables would be extended.

@jakubfijalkowski

This comment has been minimized.

Copy link

@jakubfijalkowski jakubfijalkowski commented Mar 27, 2019

All $-expressions in config file would be replaced. In my opinion this is a breaking change. Not a big one, I admit, but still a breaking change.

@weilbith

This comment has been minimized.

Copy link
Author

@weilbith weilbith commented Mar 27, 2019

Hmm. I thought nobody use such expression, since Mopidy simply does not understand them, this is only an extension and does not conflict with the current behavior. So all current configurations should work afterwards.
Anyone from the team with a comment?

@adamcik

This comment has been minimized.

Copy link
Member

@adamcik adamcik commented Nov 27, 2019

@jodal / @kingosticks is this obsolete with the switch to pathlib for 3.0?

@jodal jodal added this to the v3.0 milestone Dec 14, 2019
@jodal

This comment has been minimized.

Copy link
Member

@jodal jodal commented Dec 14, 2019

The traceback here should be fixed by the switch to pathlib in Mopidy 3.0, yes.

@jodal jodal closed this Dec 14, 2019
jodal added a commit that referenced this issue Dec 14, 2019
@weilbith

This comment has been minimized.

Copy link
Author

@weilbith weilbith commented Dec 16, 2019

Hey, sry for the stupid question, but my last point was that it is planned to migrate to Python 3 at some point. Is there already a productive version ready? Do you know when the AUR will switch?

@jodal

This comment has been minimized.

Copy link
Member

@jodal jodal commented Dec 16, 2019

Mopidy itself and a number of the most popular extensions have pre-releases on PyPI with Python 3 support. Mopidy 3.0 final is planned for Dec 21, so I assume AUR will be updated shortly after that.

You can install the pre-release by passing the --pre argument to pip: python3 -m pip install --pre mopidy. The extensions that have support for Python 3 are labeled as such at https://mopidyc.om/ext.

@weilbith

This comment has been minimized.

Copy link
Author

@weilbith weilbith commented Dec 16, 2019

@jodal thanks for the fast reply!
So I'm not into how the plugins work here. But I guess it will be a breaking change and plugins which do not update to Python 3 as well will not work with the new Mopidy core?

@jodal

This comment has been minimized.

Copy link
Member

@jodal jodal commented Dec 16, 2019

That's correct, and why we've had a two month long pre-release run where we've pushed the most popular extension to prepare in parallell with core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.