Pyradio halts with "Error: moving files to XDG directories failed..." (Solved)

Hello, this worked fine for a long time. Pyradio still works fine on two of three machines. But after the latest round of updates, one machine exhibits this behavior:

me@mine ~ $ pyradio
Moving files to XDG directories …
Error: moving files to XDG directories failed…
Cleaning up…
Press ENTER to exit…
me@mine ~ $

I figured this was some XDG peculiarity on that particular machine, so edited .bashrc and added:

export XDG_CONFIG_HOME=“$HOME/.config”
export XDG_CACHE_HOME=“$HOME/.cache”
export XDG_DATA_HOME=“$HOME/.local/share”
export XDG_STATE_HOME=“$HOME/.local/state”
export XDG_RUNTIME_DIR=“/run/user/$UID”
export XDG_DATA_DIRS=“/usr/local/share:/usr/share”
export XDG_CONFIG_DIRS=“/etc/xdg”

But this has no affect. Interestingly, the output is different if sudo is used:

me@mine ~ $ sudo pyradio
Moving files to XDG directories …
Reading playlist…
Traceback (most recent call last):
File “/usr/bin/pyradio”, line 8, in
sys.exit(shell())
^^^^^^^
File “/usr/lib/python3.12/site-packages/pyradio/main.py”, line 962, in shell
curses.wrapper(pyradio.setup)
File “/usr/lib/python3.12/curses/init.py”, line 94, in wrapper
return func(stdscr, *args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.12/site-packages/pyradio/radio.py”, line 1046, in setup
self.log = Log(self._cnf, lambda: self._remote_control_server)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.12/site-packages/pyradio/log.py”, line 89, in init
self._get_startup_window_title()
File “/usr/lib/python3.12/site-packages/pyradio/log.py”, line 647, in _get_startup_window_title
self._startup_title = ‘-= ’ + user + ’ - ’ + pwd + ’ =-’
~~~~~~~~~~~~~~~~~^
TypeError: can only concatenate str (not “NoneType”) to str
me@mine ~ $

In either case, an open PCmanFM in any of the used directories (such as ~/.config/pyradio) blinks for a split second, indicating that the files are copied. Checking the permissions on all relevant XDG folders, all are normal. Likewise, there are no ~/.local/state entries, and I can mkdir ~/.local/state/pyradio and pyradio deletes this. So there is no physical reason why it cannot access these folders. Any ideas?

Update. pyradio github gives several notices and warnings about recent changes. The issue is explained - PIP is not allowed to install packages anymore, so update may fail. How to Build says that pipx is now required to install. There is an example of how to install it.

So after removing pyradio and successfully building it this way:

me@mine ~/Downloads/pyradio $ pyradio
XDG Dirs found; enabling XDG Base compliant operation
Moving files to XDG directories …
Error: moving files to XDG directories failed…
Cleaning up…
Press ENTER to exit…

Hello @rdtsc

This is strange…

In order to get some kind of hint on what is going on can you please modify xdg.py to enable output to console?

This is where to find it if you still have the “local” build installation:

fing ~/.local/pipx/venvs/pyradio -name xdg.py

Either there, or /usr/lib/python3.12/site-packages/pyradio (if you have installed a package)

When you get to the directory, execute:

sed -i 's/_verbose = False/_verbose = True/' xdg.py

Then execute pyradio as a normal user and let’s see the output

Hi sng, found the package here:

me@mine ~ $ find ~/.local/share/pipx/venvs/pyradio -name xdg.py
/home/me/.local/share/pipx/venvs/pyradio/lib/python3.12/site-packages/build/lib/pyradio/xdg.py
/home/me/.local/share/pipx/venvs/pyradio/lib/python3.12/site-packages/pyradio/xdg.py

Running pyradio now, with verbose output:

me@mine ~/.local/share/pipx/venvs/pyradio/lib/python3.12/site-packages/pyradio $ pyradio
XDG Dirs found; enabling XDG Base compliant operation
Moving files to XDG directories ...
> Copying files to "data" dir
  /home/me/.config/pyradio/data/INSTALLATION_TYPE                   -> /home/me/.local/share/pyradio/INSTALLATION_TYPE
  /home/me/.config/pyradio/data/cover.png                           -> /home/me/.local/share/pyradio/cover.png
  /home/me/.config/pyradio/data/pyradio.png                         -> /home/me/.local/share/pyradio/pyradio.png
> Nothing to copy to "state" dir
> Copying files to "pytadio-not-migrated" dir
  /home/me/.config/pyradio/iheart-pyradio/iheart-mplayer/iheart-mpv -> /home/me/pyradio-not-migrated/iheart-mpv
Error: moving files to XDG directories failed...
Cleaning up...
Press ENTER to exit... 

So it looks like the iheart-mpv file is trying to be moved to a folder that does not exist (~/pyradio-not-migrated). Thinking simply creating this folder would solve it, nothing changed. It appears that pyradio creates this folder then removes it.

Found the issue. At some point I had downloaded a .git repo for iheart-mpv and left this in ~/.config/pyradio/iheart-pyradio. Simply archiving that folder and deleting it allowed pyradio to move the archive:

me@mine ~/.config/pyradio $ pyradio
XDG Dirs found; enabling XDG Base compliant operation
Moving files to XDG directories ...
> Copying files to "data" dir
  /home/me/.config/pyradio/data/INSTALLATION_TYPE -> /home/me/.local/share/pyradio/INSTALLATION_TYPE
  /home/me/.config/pyradio/data/cover.png         -> /home/me/.local/share/pyradio/cover.png
  /home/me/.config/pyradio/data/pyradio.png       -> /home/me/.local/share/pyradio/pyradio.png
> Nothing to copy to "state" dir
> Copying files to "pytadio-not-migrated" dir
  /home/me/.config/pyradio/iheart.7z              -> /home/me/pyradio-not-migrated/iheart.7z
Cleaning up...
Press ENTER to continue... 
Reading playlist...
Thank you for using PyRadio. Cheers!

Thank you sng! :slight_smile:

1 Like