x89 / Shreddit

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

ValueError: Unknown attribute: 'hours'.? #165

Open extremelybadsoraka opened 3 years ago

extremelybadsoraka commented 3 years ago

I am pretty new to python, but i have been able to follow all steps except at last when I run shreddit, Iget: 'ValueError: Unknown attribute: 'hours'. error.

Here is what happens: INFO:shreddit:Logged in as [redacted] Traceback (most recent call last): File "C:\Users[redacted]\AppData\Local\Programs\Python\Python38-32\Scripts\shreddit-script.py", line 11, in load_entry_point('shreddit==6.0.7', 'console_scripts', 'shreddit')() File "c:\users[redacted]\appdata\local\programs\python\python38-32\lib\site-packages\shreddit\app.py", line 44, in main shredder = Shredder(default_config, args.user) File "c:\users[redacted]\appdata\local\programs\python\python38-32\lib\site-packages\shreddit\shredder.py", line 33, in init self._recent_cutoff = arrow.now().replace(hours=-self._hours) File "c:\users[redacted]\appdata\local\programs\python\python38-32\lib\site-packages\arrow\arrow.py", line 949, in replace raise ValueError(f"Unknown attribute: {key!r}.") ValueError: Unknown attribute: 'hours'.

mbap commented 3 years ago

Check out https://github.com/x89/Shreddit/pull/142/files

mbap commented 3 years ago

If you apply that it should work.

Alternatively:

     1 diff --git a/shreddit/shredder.py b/shreddit/shredder.py
      2 index c4633a0..6a02bf6 100644
      3 --- a/shreddit/shredder.py
      4 +++ b/shreddit/shredder.py
      5 @@ -30,8 +30,8 @@ class Shredder(object):
      6          if self._save_directory:
      7              self._r.config.store_json_result = True
      8
      9 -        self._recent_cutoff = arrow.now().replace(hours=-self._hours)
     10 -        self._nuke_cutoff = arrow.now().replace(hours=-self._nuke_hours)
     11 +        self._recent_cutoff = arrow.now().replace(hour=-self._hours)
     12 +        self._nuke_cutoff = arrow.now().replace(hour=-self._nuke_hours)
     13          if self._save_directory:
     14              if not os.path.exists(self._save_directory):
     15                  os.makedirs(self._save_directory)
(END)
jeremyjjbrown commented 3 years ago

Why doesn't this just get merged?

pixiekat commented 3 years ago

When this is applied, the error then becomes:

ValueError: hour must be in 0..23

skorokithakis commented 3 years ago

I have the same issue as well. Is there a version I can downgrade to that works?

pixiekat commented 3 years ago

Downgraded to arrow 0.14.4 and it runs fine now for me, in the meantime.

skorokithakis commented 3 years ago

I can confirm as well, 0.14.3 works fine for me too, thank you.

Drugantibus commented 3 years ago

The solution in #152 worked for me

andreasbrett commented 2 years ago

When this is applied, the error then becomes:

ValueError: hour must be in 0..23

In shredder.py replace the arrow function "replace" with the arrow function "shift" and everything works as expected.

self._recent_cutoff = arrow.now().replace(hours=-self._hours)
self._nuke_cutoff = arrow.now().replace(hours=-self._nuke_hours)

becomes

self._recent_cutoff = arrow.now().shift(hours=-self._hours)
self._nuke_cutoff = arrow.now().shift(hours=-self._nuke_hours)