Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
extremelybadsoraka opened this issue Apr 6, 2021 · 9 comments
Open

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

extremelybadsoraka opened this issue Apr 6, 2021 · 9 comments

Comments

@extremelybadsoraka
Copy link

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
Copy link

mbap commented Apr 15, 2021

@mbap
Copy link

mbap commented Apr 15, 2021

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
Copy link

Why doesn't this just get merged?

@pixiekat
Copy link

When this is applied, the error then becomes:

ValueError: hour must be in 0..23

@skorokithakis
Copy link

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

@pixiekat
Copy link

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

@skorokithakis
Copy link

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

@Drugantibus
Copy link

The solution in #152 worked for me

@andreasbrett
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants