cast_control
cast_control copied to clipboard
ImportError: cannot import name '_PosixFlavour' from 'pathlib'
AUR package maintainer here. I've updated everything now that Python 3.12 is available in Arch, however...
Traceback (most recent call last):
File "/usr/bin/cast_control", line 5, in <module>
from cast_control.app.cli import cli
File "/usr/lib/python3.12/site-packages/cast_control/app/cli.py", line 8, in <module>
from .daemon import Args, MprisDaemon, get_daemon, get_daemon_from_args
File "/usr/lib/python3.12/site-packages/cast_control/app/daemon.py", line 12, in <module>
from .state import setup_logging
File "/usr/lib/python3.12/site-packages/cast_control/app/state.py", line 10, in <module>
from aiopath import AsyncPath
File "/usr/lib/python3.12/site-packages/aiopath/__init__.py", line 2, in <module>
from .path import AsyncPath, AsyncPurePath, AsyncWindowsPath, \
File "/usr/lib/python3.12/site-packages/aiopath/path.py", line 10, in <module>
from .flavours import _async_windows_flavour, _async_posix_flavour
File "/usr/lib/python3.12/site-packages/aiopath/flavours.py", line 2, in <module>
from pathlib import _PosixFlavour, _WindowsFlavour
ImportError: cannot import name '_PosixFlavour' from 'pathlib' (/usr/lib/python3.12/pathlib.py)
+1
same error. maybe this can help https://github.com/hadialqattan/pycln/issues/221 (they had the same issue)
same error. maybe this can help hadialqattan/pycln#221 (they had the same issue)
That is exactly what causes this issue. Installing aiopath v0.7.1+ fixes this problem. Requested python-aiopath maintainer update this package.
I tried aiopath 0.7.1 and 0.7.6, now there's a different error:
❯ cast_control service connect
Traceback (most recent call last):
File "/usr/bin/cast_control", line 8, in <module>
sys.exit(cli())
^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/cast_control/app/cli.py", line 208, in connect
args.save()
File "/usr/lib/python3.12/site-packages/cast_control/app/daemon.py", line 103, in save
ARGS.write_bytes(dump)
File "/usr/lib/python3.12/pathlib.py", line 1036, in write_bytes
with self.open(mode='wb') as f:
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/pathlib.py", line 1013, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/yochanan/.local/state/cast_control/0.14.0/service-args.tmp'
@yochananmarqos this might be some other issue not related with aiopath
. With aiopath 0.6.11
you get this:
$ cast_control --help
Traceback (most recent call last):
File "/usr/bin/cast_control", line 5, in <module>
from cast_control.app.cli import cli
File "/usr/lib/python3.12/site-packages/cast_control/app/cli.py", line 8, in <module>
from .daemon import Args, MprisDaemon, get_daemon, get_daemon_from_args
File "/usr/lib/python3.12/site-packages/cast_control/app/daemon.py", line 12, in <module>
from .state import setup_logging
File "/usr/lib/python3.12/site-packages/cast_control/app/state.py", line 10, in <module>
from aiopath import AsyncPath
File "/usr/lib/python3.12/site-packages/aiopath/__init__.py", line 2, in <module>
from .path import AsyncPath, AsyncPurePath, AsyncWindowsPath, \
File "/usr/lib/python3.12/site-packages/aiopath/path.py", line 10, in <module>
from .flavours import _async_windows_flavour, _async_posix_flavour
File "/usr/lib/python3.12/site-packages/aiopath/flavours.py", line 2, in <module>
from pathlib import _PosixFlavour, _WindowsFlavour
ImportError: cannot import name '_PosixFlavour' from 'pathlib' (/usr/lib/python3.12/pathlib.py)
With 0.7.1 and 0.7.6
$ cast_control --help
Usage: cast_control [OPTIONS] COMMAND [ARGS]...
Control casting devices via Linux media controls and desktops.
This daemon connects your casting device to the D-Bus media player interface
(MPRIS).
See https://github.com/alexdelorenzo/cast_control for more information.
Options:
-L, --license Show license and copyright information.
-V, --version Show version information.
--help Show this message and exit.
Commands:
connect Connect to a device and run the service in the foreground.
service Connect, disconnect or reconnect the background service to or...
@BanditSan Yes, you're right. I manually created the ~/.local/state/cast_control/0.14.0/
folder and the files were able to be created. It seems to be attempting to work now.
Anyway, I've updated the python-aiopath
AUR package to 0.7.6.