Skip to content Skip to sidebar Skip to footer

"attributeerror: '_notset' Object Has No Attribute 'lower'" When A Praw Python File Is Converted To An Exe Using Pyinstaller

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

Solution 1:

I had this error and found that to resolve it you need to have a copy of the praw.ini in the directory where you a running the executable (your_app.exe) from. You can find your praw.ini in your installed \praw directory.

Solution 2:

Right.

So, pyinstaller isn't a perfect .py to .exe converter, so some things get lost in translation.

I first commented out all updating in praw as this caused a crash in the .exe created by pyinstaller (note everything I did here caused errors in the .exe but never in the .py).

I then had to manually set some variables along the way because they weren't set when they were called in the .exe version. Either threading is used in PRAW and in the .exe version it can't keep up, or there's some seriously weird shit going on.

Yeh so I basically just modified code all throughout praw so this thing would run. If anyone comes across this issue like me and can't find the answer anywhere (because trust me I scoured planet Earth and it's no where to be found) message me and I can send you my praw version.

May god forbid you get this error

Solution 3:

Have no fear! In lieu of a properly-packaged praw.ini, the configuration it contains can also be explicitly provided as args to the Reddit constructor:

reddit = praw.Reddit(
    client_id="CHANGEME",
    client_secret="CHANGEME",
    user_agent="CHANGEME",
    check_for_updates=False,
    comment_kind="t1",
    message_kind="t4",
    redditor_kind="t2",
    submission_kind="t3",
    subreddit_kind="t5",
    trophy_kind="t6",
    oauth_url="https://oauth.reddit.com",
    reddit_url="https://www.reddit.com",
    short_url="https://redd.it",
    ratelimit_seconds=5,
    timeout=16,
)

The above code works great for me, even after being packaged with PyInstaller. Note that future PRAW updates may add more defaults to praw.ini, so you'll have to copy them over or you'll get similar errors about unset config options.

See this GitHub issue: https://github.com/praw-dev/praw/issues/1016.

Post a Comment for ""attributeerror: '_notset' Object Has No Attribute 'lower'" When A Praw Python File Is Converted To An Exe Using Pyinstaller"