x89 / Shreddit

Remove your comment history on Reddit as deleting an account does not do so.
Other
998 stars 134 forks source link

Can't run, AttributeError #152

Closed ghost closed 4 years ago

ghost commented 4 years ago

When I try to run, I get this error:

INFO:shreddit:Logged in as XXX.
Traceback (most recent call last):
  File "/home/xxx/.local/bin/shreddit", line 11, in <module>
    sys.exit(main())
  File "/home/xxx/.local/lib/python3.6/site-packages/shreddit/app.py", line 44, in main
    shredder = Shredder(default_config, args.user)
  File "/home/xxx/.local/lib/python3.6/site-packages/shreddit/shredder.py", line 33, in __init__
    self._recent_cutoff = arrow.now().replace(hours=-self._hours)
  File "/home/xxx/.local/lib/python3.6/site-packages/arrow/arrow.py", line 622, in replace
    raise AttributeError('unknown attribute: "{}"'.format(key))
AttributeError: unknown attribute: "hours"

Any ideas?

tilleyc commented 4 years ago

You most likely have a newer version of the arrow package than what is in the requirements.txt here - easiest way to check will be to run pip show arrow; if this is newer than 0.10.0, try the following:

pip uninstall arrow
pip install arrow==0.9.0

That should install either 0.9.0 or 0.10.0, and should work. I was having the same issue and followed these steps and was able to get the script working (Python 3.8.2 on Windows 10).

A true fix would be to update shredder.py to account for the code change between 0.10.0 and newer versions of the arrow package, but at least downgrading it for now will get you working.

fluoridepsychosis commented 4 years ago

I am also having this issue, downgrading to arrow 0.9.0 fixed it for me but it is a bit janky to have to revert an update to get this working.

ghost commented 4 years ago

Yeah, my arrow was 0.15.5, downgrading to 0.9.0 did the trick, thanks for the help! :)

tilleyc commented 4 years ago

I am also having this issue, downgrading to arrow 0.9.0 fixed it for me but it is a bit janky to have to revert an update to get this working.

Quite true. I've not had the time to look at it yet but any of us could take a swing at it. :)

Hund commented 2 years ago

Downgrading to 0.9.0 didn't fix it for me. I still get the same error message.

Edit: Version 0.14.4 worked for me.

pidg commented 2 years ago

To save any other complete Python noobs the search, pip install --force-reinstall arrow==0.14.4

Then shreddit magically works