jmbannon / ytdl-sub

Lightweight tool to automate downloading and metadata generation with yt-dlp
https://ytdl-sub.readthedocs.io
GNU General Public License v3.0
1.74k stars 70 forks source link

Uncaught Exception during subscription download #504

Closed bpoulliot closed 1 year ago

bpoulliot commented 1 year ago

I have no idea how to trace this for now, as I'm redirecting output to a log file that I check for troubleshooting purposes, but there's not enough info there and I'm afraid that if I change my run_cron file to verbose output that this log file will be absolutely ENORMOUS by the time I catch up with it. Here's the exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/ytdl_sub/main.py", line 29, in main
    _main()
  File "/usr/lib/python3.10/site-packages/ytdl_sub/main.py", line 20, in _main
    ytdl_sub.cli.main.main()
  File "/usr/lib/python3.10/site-packages/ytdl_sub/cli/main.py", line 177, in main
    transaction_logs = _download_subscriptions_from_yaml_files(config=config, args=args)
  File "/usr/lib/python3.10/site-packages/ytdl_sub/cli/main.py", line 50, in _download_subscriptions_from_yaml_files
    subscriptions += Subscription.from_file_path(config=config, subscription_path=path)
  File "/usr/lib/python3.10/site-packages/ytdl_sub/subscriptions/subscription.py", line 83, in from_file_path
    has_file_preset = FILE_PRESET_APPLY_KEY in subscription_dict
TypeError: argument of type 'NoneType' is not iterable
[ytdl-sub] Version 2023.02.24+a4dc61e

I'm adding this issue now because I can't trace this to which config I'm running is the problem. I have four set up with run_cron using a semicolon (rather than &&) to ensure the last process is complete prior to starting the next subscription. I can run these one-by-one to see if I can isolate and will update with what I find.

jmbannon commented 1 year ago

Update your version to the latest - I think I might have screwed up a few of these earlier builds

jmbannon commented 1 year ago

Also can you paste the command you're using? It might think one of your args unintentionally is a YAML file. Like if you do ytdl-sub sub ./*, that can cause issues

bpoulliot commented 1 year ago

Full (virtualized) path specified in each command.

#!/bin/bash
echo "Cron started, scraping subscription: YouTube (1/4)..." ; 
ytdl-sub --config=/config/data/yt-conf/config.yaml sub /config/data/yt-conf/subscriptions.yaml >> /config/data/cron.log 2>&1 ; 
echo "Scraping subscription: Bandcamp (2/4)..." ; 
ytdl-sub --config=/config/data/bc-conf/config.yaml sub /config/data/bc-conf/subscriptions.yaml >> /config/data/cron.log 2>&1 ; 
echo "Scraping subscription: PD (3/4)..." ; 
ytdl-sub --config=/config/data/pd-conf/config.yaml sub /config/data/pd-conf/subscriptions.yaml >> /config/data/cron.log 2>&1 ; 
echo "Scraping subscription: YT Music (4/4)..." ; 
ytdl-sub --config=/config/data/ytm-conf/config.yaml sub /config/data/ytm-conf/subscriptions.yaml >> /config/data/cron.log 2>&1

Possibly important that I'm using docker-compose for my setup. I was fairly sure I was updated when I ran this, but I know I've updated since (yesterday) and will do a bit of digging later today if I'm able.

bpoulliot commented 1 year ago

I have verified that everything is running for me (impatience != virtue), but I'm still getting the same issue without enough info to trace it back to where issues are occurring.

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/ytdl_sub/main.py", line 26, in main
    _main()
  File "/usr/lib/python3.10/site-packages/ytdl_sub/main.py", line 18, in _main
    ytdl_sub.cli.main.main()
  File "/usr/lib/python3.10/site-packages/ytdl_sub/cli/main.py", line 232, in main
    transaction_logs = _download_subscriptions_from_yaml_files(
  File "/usr/lib/python3.10/site-packages/ytdl_sub/cli/main.py", line 92, in _download_subscriptions_from_yaml_files
    subscriptions += Subscription.from_file_path(config=config, subscription_path=path)
  File "/usr/lib/python3.10/site-packages/ytdl_sub/subscriptions/subscription.py", line 83, in from_file_path
    has_file_preset = FILE_PRESET_APPLY_KEY in subscription_dict
TypeError: argument of type 'NoneType' is not iterable
[ytdl-sub] Version 2023.03.08+fddf3d3

I did -- at one point -- try to use a preset file for a single config/subscription pair, but did away with that pretty quickly and there is no trace of this left anywhere. I have scoured everything I have running.

jmbannon commented 1 year ago

Can you paste the config and subscription file this happens on?

jmbannon commented 1 year ago

I think this should cover it: https://github.com/jmbannon/ytdl-sub/pull/541 Basically, None is getting returned after loading a YAML file. This means you might be passing an empty subscription file.

jmbannon commented 1 year ago

Going to close, please comment and I'll reopen if more strangeness occurs