mikeizbicki / cmc-csci040

Computing for the Web
36 stars 59 forks source link

configparser.DuplicateOptionError #290

Closed PArellano02 closed 1 year ago

PArellano02 commented 1 year ago

Hopefully this is my last issue. I was running my code perfectly, alternating with a couple of bots but without changing anything, I got the following error on when I tried to run it again a few seconds later.

I think its a reddit issue but I do not know. The same error cam up when I tried all my bots on the bot_counter.py file so it comes up right at the log in.

Traceback (most recent call last): File "/Users/pedroarellano/Documents/GitHub/reddit_bot-/bot_counter.py", line 12, in reddit = praw.Reddit(args.praw_name) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/praw/util/deprecate_args.py", line 43, in wrapped return func(dict(zip(_old_args, args)), kwargs) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/praw/reddit.py", line 236, in init self.config = Config( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/praw/config.py", line 81, in init self._load_config(config_interpolation=config_interpolation) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/praw/config.py", line 58, in _load_config config.read(locations) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/configparser.py", line 698, in read self._read(fp, filename) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/configparser.py", line 1097, in _read raise DuplicateOptionError(sectname, optname, configparser.DuplicateOptionError: While reading from 'praw.ini' [line 30]: option 'client_id' in section 'BOTtledupemotions26' already exist

mikeizbicki commented 1 year ago

Hmm... I haven't seen this error before, but my guess is that your praw.ini file is misconfigured somehow to have two lines [BOTtledupemotions26].

PS. Putting your error messages in code blocks with the triple backticks makes them easier to read.

PArellano02 commented 1 year ago

I have checked and there are no duplicates. This also happens for all bots: ones that I had used before and had not changes and also ones that I had not used before.

Traceback (most recent call last):
File "/Users/pedroarellano/Documents/GitHub/reddit_bot-/bot_counter.py", line 12, in
reddit = praw.Reddit(args.praw_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/praw/util/deprecate_args.py", line 43, in wrapped
return func(**dict(zip(_old_args, args)), **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/praw/reddit.py", line 236, in init
self.config = Config(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/praw/config.py", line 81, in init
self._load_config(config_interpolation=config_interpolation)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/praw/config.py", line 58, in _load_config
config.read(locations)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/configparser.py", line 698, in read
self._read(fp, filename)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/configparser.py", line 1097, in _read
raise DuplicateOptionError(sectname, optname,
configparser.DuplicateOptionError: While reading from 'praw.ini' [line 30]: option 'client_id' in section 'BOTtledupemotions26' already exist
PArellano02 commented 1 year ago

I figured it out!!! I was just in the process of creating my last bot when i tried running it again so I had a section with a bunch of empty credentials and this was giving me the error.

I did panic right there for a second