Yaml.unsafe_load error

Albert-Jan Roskam sjeik_appie at hotmail.com
Wed Oct 19 14:01:03 EDT 2022


   On Oct 19, 2022 13:02, Albert-Jan Roskam <sjeik_appie at hotmail.com> wrote:

        Hi,
        I am trying to create a celery.schedules.crontab object from an
     external
        yaml file. I can successfully create an instance from a dummy class
     "Bar",
        but the crontab class seems call __setstate__ prior to __init__. I
     have no
        idea how to solve this. Any ideas? See code below.
        Thanks!
        Albert-Jan

        

         

        # what is the correct way for the next line?

        >>> yaml.unsafe_load('!!python/object:celery.schedules.crontab\n  
     hour:
        3\n   minute: 30')

       

   ====
   Reading the source a bit more, me thinks it might be:
   yaml.unsafe_load('!!python/object/apply:celery.schedules.crontab\nkwds:\n 
    hour: 3\n   minute: 30')
   I did not yet test this, though.


More information about the Python-list mailing list