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

After Cache File is Modified, the Bot Is Prevented from Running because of It Not Properly Recognized (So It Seems) #120

Open
ChrisDuffley opened this issue Mar 27, 2024 · 3 comments

Comments

@ChrisDuffley
Copy link

ChrisDuffley commented Mar 27, 2024

As far as my limited Python knowledge goes it seems to me that after subsequent restarts of the bot, the cache file is not actually being loaded even though it clearly states it's the right one in the JSON file.

Here's what I get after running it with ./TTMediaBot.sh:

/home/chris/.local/lib/python3.10/site-packages/pydantic/_migration.py:283: UserWarning: `pydantic.error_wrappers:ValidationError` has been moved to `pydantic:ValidationError`.
  warnings.warn(f'`{import_path}` has been moved to `{new_location}`.')
Traceback (most recent call last):
  File "/home/chris/TTMediaBot/TTMediaBot.py", line 64, in <module>
    main()
  File "/home/chris/TTMediaBot/TTMediaBot.py", line 45, in main
    bot = Bot(config, cache, log)
  File "/home/chris/TTMediaBot/bot/__init__.py", line 60, in __init__
    self.cache_manager = cache.CacheManager(cache_file_name)
  File "/home/chris/TTMediaBot/bot/cache.py", line 42, in __init__
    self.data = cache_migrator.migrate(self, self._load())
  File "/home/chris/TTMediaBot/bot/cache.py", line 55, in _load
    return pickle.load(f)
  File "/home/chris/.local/lib/python3.10/site-packages/yt_dlp/utils/networking.py", line 70, in __setitem__
    super().__setitem__(key.title(), str(value).strip())
  File "/usr/lib/python3.10/collections/__init__.py", line 1109, in __setitem__
    self.data[key] = item
AttributeError: 'HTTPHeaderDict' object has no attribute 'data'

Running on a test instance of Ubuntu 22.04 before I upgrade my main server. Any reason why this is happening and can this be fixed?

@ChrisDuffley ChrisDuffley changed the title After Cache File is Modified, the Bot Is Prevented from Running because of It Not Properly Recognized After Cache File is Modified, the Bot Is Prevented from Running because of It Not Properly Recognized (So It Seems) Mar 27, 2024
@ivnc
Copy link
Contributor

ivnc commented Apr 12, 2024

I also have various bots, running on Docker, which sometimes don't start correctly due to this issue. The only solution that has worked to me is to move or remove the cache file. Actually I was unable to figure out what exact change in cache contents causes this, because the issue doesn't happen every time.

@cyrmax
Copy link
Collaborator

cyrmax commented Apr 13, 2024

Hi guys! Could you tell please what services do you use? I guess that this is only youtube and neither vk nor yam but just to be sure.

Also do you play just videos or also raw url streams?

Try to reproduce the issue please.

@ivnc
Copy link
Contributor

ivnc commented May 6, 2024

Yes, only Youtube, the other services are directly disabled. I think that no matter if we search videos or we play raw URLs, but we don't play URLs very often.
With regard to reproducing the issue, I have seen cache files only with one or two recent videos (only Youtube search, no URLs) causing this, and others, with the same number of videos, not, so...couldn't get the reproduction pattern so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants