ValidatePrefs issue

So I’m trying to use the ValidatePrefs function to propagate the Preferences to my library (python code library). For this it is essential to have this function run anytime the user changes their Preferences. However, this does not happen and the function does not run and instead I see a Critical Error entry. Am I doing something wrong ?

2018-06-28 08:07:15,204 (db0) :  DEBUG (preferences:198) - Saved the user preferences
2018-06-28 08:07:15,206 (db0) :  CRITICAL (sandbox:298) - Function named 'ValidatePrefs' couldnt be found in the current environment
@route(PREFIX + "/ValidatePrefs")
def ValidatePrefs():
        val = Prefs['val_to_propagate_key']
        my_lib_control.set('val_to_propagate_key', val)

Mods please report this to the concerned Plex developers if this is a genuine bug.

Is your PREFIX set correctly?

I think so since my MainMenu uses the same…

@handler(PREFIX, TITLE, art=common.ART, thumb=common.ICON)
@route(PREFIX + "/MainMenu")
def MainMenu(**kwargs):

EDIT: Well I see it being used in WebTools and it works fine there so it seems something in my code is causing this issue. So doesn’t look like a bug.

Confirmed not to be a bug, by testing in WebTools :smiley:

All good now… refactoring of code went a lil too far. I guess some core functions need to reside in the __init__.py file.

Sadly so, and as far as I found out, only files located side by side with the init.py file can use the framework.

If you put them in like a shared directory or siml, framework functions are not avail for them, AFAICT

Well previously I did have it in a separate main.py file (residing next to init.py) but it doesn’t seem to be accessible even from there.

Going offtopic… the code/preformatted text option of Discourse needs a better template for the Plex Dark theme, its almost non-viewable with its contrasting white. Also, something that might not be realized outside of the Dev section(s) where its primarily used for code.

EDIT: …and voiced my opinion here

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.