[Python] "AttributeError: '_NotSet' object has no attribute 'lower'" when a PRAW python file...

Discussão em 'Python' iniciado por Stack, Julho 14, 2025.

  1. Stack

    Stack Membro Participativo

    As the title says.

    When I execute the converted python file (the .exe) I get the following output:

    Traceback (most recent call last):
    File "background.py", line 10, in <module>
    File "site-packages\praw\reddit.py", line 129, in __init__
    File "site-packages\praw\config.py", line 72, in __init__
    File "site-packages\praw\config.py", line 98, in _initialize_attributes
    File "site-packages\praw\config.py", line 31, in _config_boolean
    AttributeError: '_NotSet' object has no attribute 'lower'
    [1692] Failed to execute script background


    I did not use a praw.ini file, instead hardcoding the values for the logon as such:

    import praw
    import praw.models
    import urllib.request
    from random import randint
    from os import getcwd
    import ctypes

    r = praw.Reddit(client_id='client',
    client_secret='secret',
    user_agent='user')
    sub = r.subreddit('earthporn')
    choose = []
    for i in sub.hot(limit=20):
    a = str(i.url)
    if "i.redd" in a or "i.imgur" in a:
    choose.append(i.url)
    x = choose[randint(0,len(choose)-1)]
    resource = urllib.request.urlopen(x)
    output = open("daily_image.jpg","wb")
    output.write(resource.read())
    output.close()


    direc = getcwd() + "\\daily_image.jpg"
    ctypes.windll.user32.SystemParametersInfoW(20, 0, direc , 0)


    The above file works in just python but not when converted to an exe. (obviously with the client,secret and user id's set, feel free to steal it idrc)

    Any help is really appreciated!

    Continue reading...

Compartilhe esta Página