exislow / tidal-dl-ng

TIDAL Media Downloader Next Generation! Up to HiRes Lossless / TIDAL MAX 24-bit, 192 kHz.
GNU Affero General Public License v3.0
418 stars 36 forks source link

[Help] Problems with PermissionError: [Errno 13] Permission denied: '/usr/bin' #170

Closed GreatOnizuka closed 1 week ago

GreatOnizuka commented 3 months ago

I need Help.

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /usr/local/lib/python3.11/dist-packages/tidal_dl_ng/cli.py:211 in download │ │ │ │ 208 │ │ │ │ │ item_ids.append(item_id) │ │ 209 │ │ │ │ │ │ 210 │ │ │ │ for item_id in item_ids: │ │ ❱ 211 │ │ │ │ │ dl.items( │ │ 212 │ │ │ │ │ │ media_id=item_id, │ │ 213 │ │ │ │ │ │ media_type=media_type, │ │ 214 │ │ │ │ │ │ file_template=file_template, │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ ctx = <click.core.Context object at 0x7f911d9c50> │ │ │ │ dl = <tidal_dl_ng.download.Download object at 0x7f8d3fa090> │ │ │ │ file_template = '{album_artist}/{album_title}{album_explicit}/{album_track_num}. │ │ │ │ {artist_name} - '+13 │ │ │ │ file_urls = None │ │ │ │ fn_logger = <tidal_dl_ng.helper.wrapper.LoggerWrapped object at 0x7f8d3fa050> │ │ │ │ item = 'https://tidal.com/browse/album/375825749?u' │ │ │ │ item_id = '375825749' │ │ │ │ item_ids = ['375825749'] │ │ │ │ media_type = <MediaType.ALBUM: 'album'> │ │ │ │ progress = <rich.progress.Progress object at 0x7f8d3c0ad0> │ │ │ │ progress_table = <rich.table.Table object at 0x7f8d3fa0d0> │ │ │ │ settings = <tidal_dl_ng.config.Settings object at 0x7f907d94d0> │ │ │ │ urls = ['https://tidal.com/browse/album/375825749?u'] │ │ │ │ urls_pos_last = 0 │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.11/dist-packages/tidal_dl_ng/download.py:458 in items │ │ │ │ 455 │ │ while not self.progress.finished: │ │ 456 │ │ │ for media in items: │ │ 457 │ │ │ │ # Download the item. │ │ ❱ 458 │ │ │ │ status_download, result_path_file = self.item( │ │ 459 │ │ │ │ │ media=media, │ │ 460 │ │ │ │ │ file_template=file_name_relative, │ │ 461 │ │ │ │ │ quality_audio=quality_audio, │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ download_delay = True │ │ │ │ file_name_relative = 'Vitamin String Quartet/VSQ Performs the Hits of │ │ │ │ 2024/{album_track_num}. Vitamin '+30 │ │ │ │ file_template = '{album_artist}/{album_title}{album_explicit}/{album_track_num}. │ │ │ │ {artist_name} - '+13 │ │ │ │ items = [ │ │ │ │ │ <tidalapi.media.Track object at 0x7f910b8550>, │ │ │ │ │ <tidalapi.media.Track object at 0x7f92d2a850>, │ │ │ │ │ <tidalapi.media.Track object at 0x7f907e4110>, │ │ │ │ │ <tidalapi.media.Track object at 0x7f8d3fa450>, │ │ │ │ │ <tidalapi.media.Track object at 0x7f8d417fd0>, │ │ │ │ │ <tidalapi.media.Track object at 0x7f8d417810>, │ │ │ │ │ <tidalapi.media.Track object at 0x7f8d3c2150>, │ │ │ │ │ <tidalapi.media.Track object at 0x7f8d3c2490> │ │ │ │ ] │ │ │ │ list_media_name = 'VSQ Performs the Hits of 2024' │ │ │ │ media = <tidalapi.media.Track object at 0x7f910b8550> │ │ │ │ media_id = '375825749' │ │ │ │ media_type = <MediaType.ALBUM: 'album'> │ │ │ │ p_task1 = 0 │ │ │ │ progress_stdout = True │ │ │ │ quality_audio = None │ │ │ │ quality_video = None │ │ │ │ self = <tidal_dl_ng.download.Download object at 0x7f8d3fa090> │ │ │ │ video_download = False │ │ │ │ videos_include = False │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.11/dist-packages/tidal_dl_ng/download.py:271 in item │ │ │ │ 268 │ │ │ │ │ │ 269 │ │ │ │ # Extract FLAC from MP4 container using ffmpeg │ │ 270 │ │ │ │ if isinstance(media, Track) and self.settings.data.extract_flac and do_f │ │ ❱ 271 │ │ │ │ │ tmp_path_file = self._extract_flac(tmp_path_file) │ │ 272 │ │ │ │ │ │ 273 │ │ │ │ tmp_path_lyrics: pathlib.Path | None = None │ │ 274 │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ do_flac_extract = True │ │ │ │ download_delay = True │ │ │ │ file_exists = False │ │ │ │ file_extension = <AudioExtensions.FLAC: '.flac'> │ │ │ │ file_name_relative = 'Vitamin String Quartet/VSQ Performs the Hits of 2024/1. Vitamin String │ │ │ │ Quartet -'+9 │ │ │ │ file_template = 'Vitamin String Quartet/VSQ Performs the Hits of │ │ │ │ 2024/{album_track_num}. Vitamin '+30 │ │ │ │ media = <tidalapi.media.Track object at 0x7f911d9f50> │ │ │ │ media_id = None │ │ │ │ media_type = None │ │ │ │ path_media_dst = '/mnt/Vitamin String Quartet/VSQ Performs the Hits of 2024/1. Vitamin │ │ │ │ String Quar'+19 │ │ │ │ quality_audio = None │ │ │ │ quality_video = None │ │ │ │ self = <tidal_dl_ng.download.Download object at 0x7f8d3fa090> │ │ │ │ tmp_path_dir = '/tmp/tmpnjeg3h8d' │ │ │ │ tmp_path_file = '/tmp/tmpnjeg3h8d/6b8a55fb-07d8-4a24-9892-01d95f5babe7' │ │ │ │ uniquify = False │ │ │ │ video_download = True │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.11/dist-packages/tidal_dl_ng/download.py:489 in _extract_flac │ │ │ │ 486 │ │ │ .output( │ │ 487 │ │ │ │ path_media_out, map=0, movflags="use_metadatatags", acodec="copy", map │ │ 488 │ │ │ ) │ │ ❱ 489 │ │ │ .run(cmd=self.settings.data.path_binary_ffmpeg) │ │ 490 │ │ ) │ │ 491 │ │ │ │ 492 │ │ return path_media_out │ │ │ │ ╭─────────────────────────────────── locals ────────────────────────────────────╮ │ │ │ path_media_out = '/tmp/tmpnjeg3h8d/6b8a55fb-07d8-4a24-9892-01d95f5babe7.flac' │ │ │ │ path_media_src = '/tmp/tmpnjeg3h8d/6b8a55fb-07d8-4a24-9892-01d95f5babe7' │ │ │ │ self = <tidal_dl_ng.download.Download object at 0x7f8d3fa090> │ │ │ ╰───────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.11/dist-packages/ffmpeg/_run.py:313 in run │ │ │ │ 310 │ │ │ 311 │ Returns: (out, err) tuple containing captured stdout and stderr data. │ │ 312 │ """ │ │ ❱ 313 │ process = run_async( │ │ 314 │ │ stream_spec, │ │ 315 │ │ cmd, │ │ 316 │ │ pipe_stdin=input is not None, │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ capture_stderr = False │ │ │ │ capture_stdout = False │ │ │ │ cmd = '/usr/bin' │ │ │ │ input = None │ │ │ │ overwrite_output = False │ │ │ │ quiet = False │ │ │ │ stream_spec = output(acodec='copy', │ │ │ │ filename='/tmp/tmpnjeg3h8d/6b8a55fb-07d8-4a24-9892-01d95f5babe7.flac', │ │ │ │ loglevel='quiet', map=0, map_metadata='0:g', │ │ │ │ movflags='use_metadata_tags')[None] <9721f03797ab> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.11/dist-packages/ffmpeg/_run.py:284 in run_async │ │ │ │ 281 │ stdin_stream = subprocess.PIPE if pipe_stdin else None │ │ 282 │ stdout_stream = subprocess.PIPE if pipe_stdout or quiet else None │ │ 283 │ stderr_stream = subprocess.PIPE if pipe_stderr or quiet else None │ │ ❱ 284 │ return subprocess.Popen( │ │ 285 │ │ args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream │ │ 286 │ ) │ │ 287 │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ args = [ │ │ │ │ │ '/usr/bin', │ │ │ │ │ '-i', │ │ │ │ │ '/tmp/tmpnjeg3h8d/6b8a55fb-07d8-4a24-9892-01d95f5babe7', │ │ │ │ │ '-acodec', │ │ │ │ │ 'copy', │ │ │ │ │ '-loglevel', │ │ │ │ │ 'quiet', │ │ │ │ │ '-map', │ │ │ │ │ '0', │ │ │ │ │ '-map_metadata', │ │ │ │ │ ... +4 │ │ │ │ ] │ │ │ │ cmd = '/usr/bin' │ │ │ │ overwrite_output = False │ │ │ │ pipe_stderr = False │ │ │ │ pipe_stdin = False │ │ │ │ pipe_stdout = False │ │ │ │ quiet = False │ │ │ │ stderr_stream = None │ │ │ │ stdin_stream = None │ │ │ │ stdout_stream = None │ │ │ │ stream_spec = output(acodec='copy', │ │ │ │ filename='/tmp/tmpnjeg3h8d/6b8a55fb-07d8-4a24-9892-01d95f5babe7.flac', │ │ │ │ loglevel='quiet', map=0, map_metadata='0:g', │ │ │ │ movflags='use_metadata_tags')[None] <9721f03797ab> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3.11/subprocess.py:1024 in init │ │ │ │ 1021 │ │ │ │ │ self.stderr = io.TextIOWrapper(self.stderr, │ │ 1022 │ │ │ │ │ │ │ encoding=encoding, errors=errors) │ │ 1023 │ │ │ │ │ ❱ 1024 │ │ │ self._execute_child(args, executable, preexec_fn, close_fds, │ │ 1025 │ │ │ │ │ │ │ │ pass_fds, cwd, env, │ │ 1026 │ │ │ │ │ │ │ │ startupinfo, creationflags, shell, │ │ 1027 │ │ │ │ │ │ │ │ p2cread, p2cwrite, │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ args = [ │ │ │ │ │ '/usr/bin', │ │ │ │ │ '-i', │ │ │ │ │ '/tmp/tmpnjeg3h8d/6b8a55fb-07d8-4a24-9892-01d95f5babe7', │ │ │ │ │ '-acodec', │ │ │ │ │ 'copy', │ │ │ │ │ '-loglevel', │ │ │ │ │ 'quiet', │ │ │ │ │ '-map', │ │ │ │ │ '0', │ │ │ │ │ '-map_metadata', │ │ │ │ │ ... +4 │ │ │ │ ] │ │ │ │ bufsize = -1 │ │ │ │ c2pread = -1 │ │ │ │ c2pwrite = -1 │ │ │ │ close_fds = True │ │ │ │ creationflags = 0 │ │ │ │ cwd = None │ │ │ │ encoding = None │ │ │ │ env = None │ │ │ │ errors = None │ │ │ │ errread = -1 │ │ │ │ errwrite = -1 │ │ │ │ executable = None │ │ │ │ extra_groups = None │ │ │ │ gid = None │ │ │ │ gids = None │ │ │ │ group = None │ │ │ │ p2cread = -1 │ │ │ │ p2cwrite = -1 │ │ │ │ pass_fds = () │ │ │ │ pipesize = -1 │ │ │ │ preexec_fn = None │ │ │ │ process_group = -1 │ │ │ │ restore_signals = True │ │ │ │ self = <Popen: returncode: 255 args: ['/usr/bin', '-i', │ │ │ │ '/tmp/tmpnjeg3h8d/6b8a55fb-...> │ │ │ │ shell = False │ │ │ │ start_new_session = False │ │ │ │ startupinfo = None │ │ │ │ stderr = None │ │ │ │ stdin = None │ │ │ │ stdout = None │ │ │ │ text = None │ │ │ │ uid = None │ │ │ │ umask = -1 │ │ │ │ universal_newlines = None │ │ │ │ user = None │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3.11/subprocess.py:1901 in _execute_child │ │ │ │ 1898 │ │ │ │ │ │ err_filename = orig_executable │ │ 1899 │ │ │ │ │ if errno_num != 0: │ │ 1900 │ │ │ │ │ │ err_msg = os.strerror(errno_num) │ │ ❱ 1901 │ │ │ │ │ raise child_exception_type(errno_num, err_msg, err_filename) │ │ 1902 │ │ │ │ raise child_exception_type(err_msg) │ │ 1903 │ │ 1904 │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ args = [ │ │ │ │ │ '/usr/bin', │ │ │ │ │ '-i', │ │ │ │ │ '/tmp/tmpnjeg3h8d/6b8a55fb-07d8-4a24-9892-01d95f5babe7', │ │ │ │ │ '-acodec', │ │ │ │ │ 'copy', │ │ │ │ │ '-loglevel', │ │ │ │ │ 'quiet', │ │ │ │ │ '-map', │ │ │ │ │ '0', │ │ │ │ │ '-map_metadata', │ │ │ │ │ ... +4 │ │ │ │ ] │ │ │ │ c2pread = -1 │ │ │ │ c2pwrite = -1 │ │ │ │ child_exception_type = <class 'OSError'> │ │ │ │ child_exec_never_called = False │ │ │ │ close_fds = True │ │ │ │ creationflags = 0 │ │ │ │ cwd = None │ │ │ │ env = None │ │ │ │ env_list = None │ │ │ │ err_filename = '/usr/bin' │ │ │ │ err_msg = 'Permission denied' │ │ │ │ errno_num = 13 │ │ │ │ errpipe_data = bytearray(b'OSError:d:') │ │ │ │ errpipe_read = 5 │ │ │ │ errpipe_write = 6 │ │ │ │ errread = -1 │ │ │ │ errwrite = -1 │ │ │ │ exception_name = bytearray(b'OSError') │ │ │ │ executable = b'/usr/bin' │ │ │ │ executable_list = (b'/usr/bin',) │ │ │ │ fds_to_keep = {6} │ │ │ │ gid = None │ │ │ │ gids = None │ │ │ │ hex_errno = bytearray(b'd') │ │ │ │ low_fds_to_close = [] │ │ │ │ orig_executable = '/usr/bin' │ │ │ │ p2cread = -1 │ │ │ │ p2cwrite = -1 │ │ │ │ part = b'' │ │ │ │ pass_fds = () │ │ │ │ pid = 9504 │ │ │ │ preexec_fn = None │ │ │ │ process_group = -1 │ │ │ │ restore_signals = True │ │ │ │ self = <Popen: returncode: 255 args: ['/usr/bin', '-i', │ │ │ │ '/tmp/tmpnjeg3h8d/6b8a55fb-...> │ │ │ │ shell = False │ │ │ │ start_new_session = False │ │ │ │ startupinfo = None │ │ │ │ sts = 65280 │ │ │ │ uid = None │ │ │ │ umask = -1 │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ PermissionError: [Errno 13] Permission denied: '/usr/bin'

What am I doing wrong?

What operating system are you seeing the problem on?

Linux

Your settings

{"skip_existing": "False", "lyrics_embed": false, "lyrics_file": false, "video_download": false, "download_delay": true, "download_base_path": "/mnt", "quality_audio": "HI_RES_LOSSLESS", "quality_video": "480", "format_album": "{album_album_artist}/{album_title}{album_explicit}/{album_track_num}. {artist_name} - {track_title}", "format_playlist": "Playlists/{playlist_name}/{artist_name} - {track_title}", "format_mix": "Mix/{mix_name}/{artist_name} - {track_title}", ""format_track": "Tracks/{artist_name} - {track_title}{track_explicit}", "format_video": "Videos/{artist_name} - {track_title}{track_explicit}", "video_convert_mp4": true, "path_binary_ffmpeg": "/usr/bin", "metadata_cover_dimension": "320", "extract_flac": true, "downgrade_on_hi_res": false}
Pihti commented 3 months ago

are you trying to install the script? If yes, then the installer should be executed as root. Normal user cannot write to /usr/bin.

GreatOnizuka commented 3 months ago

No script is already installed, I tried to run it, and after downloading the first track, as I understand it, it tried to convert it to FLAC, but I get an error.

hsg120 commented 2 months ago

I'm having this same issue, and am also on Linux (I'm using Arch).

When the program goes to create the FLAC files it says it doesn't have permission to access the ffmpeg bin location.

PermissionError: [Errno 13] Permission denied:

I've tried running the program as root, but I get the same error. I also tried pointing to my user directory just as a test (of which, I should have permission to access) and still get a "permission denied" error when it goes to convert to FLAC.

Edit: For anyone else experiencing this issue, I ended up just using ffmpeg to convert the downloaded .m4a file to flac using the following command:

ffmpeg -i [input file path] -f flac [output file path]

Example: ffmpeg -i Underdog.m4a -f flac Underdog.flac

exislow commented 1 week ago

Set the correct path to the ffmpeg binary, not to the parent folder.