clara-j / media_cleaner

Python script to delete watched content on Emby
31 stars 17 forks source link

Error when creating an new media_cleaner_config.py #34

Closed keppo070 closed 2 years ago

keppo070 commented 2 years ago

@terrelsa13 Because of the new options. I thought I would probably need a new media_cleaner_config. I removed my old config and when creating I get the follow error.

On first look the config seems to be ok... I choose blacklist and use the enter key to accept the default -1

Choose the number of days to wait before deleting played audio media items Valid values: 0-730500 days -1 to disable deleting audio media items Enter number of days (default -1): "----------------------------------------------------------- Traceback (most recent call last): File "/home/xxx/xxx/xxx/media_cleaner/media_cleaner.py", line 3324, in import media_cleaner_config as cfg ModuleNotFoundError: No module named 'media_cleaner_config'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/xxx/xxx/xxx/media_cleaner/media_cleaner.py", line 3343, in generate_config(update_config) File "/home/xxx/xxx/xxx/media_cleaner/media_cleaner.py", line 579, in generate_config if ((cfg.not_played_age_movie == -1) and NameError: name 'cfg' is not defined

terrelsa13 commented 2 years ago

Tonight is date night with my better half. But I will be able to fix this Tuesday.

I had a feature request a few months ago to allow adding users to the existing config. Those changes are in this latest version. I must have missed something. Restore your old config if you still have it. That should work. If it does not work, the "missing" config variables will need to be added anywhere in the config file to get it going again.

Apologies for the mess up here!

terrelsa13 commented 2 years ago

@keppo070 Question: Does this error occur the first time the script runs (aka during the creation of the config file)? Or does it occur the second time the script runs (aka after the config file has been created)?

keppo070 commented 2 years ago

It occurs the first time. I deleted my old media_cleaner_config.py before starting the new media_cleaner.py. The config seems to work... but i'm not sure what is missing or not. I can post the resulting config if that helps.

terrelsa13 commented 2 years ago

From the error it appears it cannot find the media_cleaner_config.py file. But it must be there because you're seeing it.

I bet I have a chicken and egg thing happening somewhere. It appears it is trying to do a dry-run the first time the script is run. That shouldn't happen. The first run should just build a config. The next runs should execute the "cleaning" parts of the script.

Will you verify UPDATE_CONFIG=FALSE and script_behavior=blacklist in the new config file?

keppo070 commented 2 years ago

https://pastebin.com/i101bEWm my media_player_config.py which was the resulting after the error

I did try to do something with git maybe I got it wrong. I will try with a manual download of media_cleaner.py

no, the same error after downloading it again

terrelsa13 commented 2 years ago

@keppo070 I definitely missed a condition where the script was reading the cfg.xyz variable before the media_cleaner_config.py file was imported. This should now be fixed in the master.

Let me know if you have any other issues.