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!
praw.ini
. (probably from the package itself). Can you place apraw.ini
next to you .exe to verify? – Eratosthenesmodule_dir = os.path.dirname(sys.modules[__name__].__file__)
in combination withos.path.join(module_dir, 'praw.ini')
does not result in a loadable file path. As a result, the system-levelpraw.ini
file isn't loading which has the base settings. A simple solution would be to copy that file into the directory that you execute your program from, that should resolve your issues. – Denoting