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

documentation incorrect: muted() → praw.models.reddit.subreddit.SubredditRelationship #1925

Closed
computerologist opened this issue Dec 25, 2022 · 4 comments · Fixed by #1935

Comments

@computerologist
Copy link

computerologist commented Dec 25, 2022

Describe the Bug

Errors when example code is executed.

Docs here: https://praw.readthedocs.io/en/stable/code_overview/other/subredditrelationship.html#praw.models.reddit.subreddit.SubredditRelationship

Desired Result

Change the docs?

Relevant Logs

c:\python39\lib\site-packages\praw\models\reddit\base.py in __getattr__(self, attribute)
     33         if not attribute.startswith("_") and not self._fetched:
     34             self._fetch()
---> 35             return getattr(self, attribute)
     36         raise AttributeError(
     37             f"{self.__class__.__name__!r} object has no attribute {attribute!r}"

c:\python39\lib\site-packages\praw\models\reddit\base.py in __getattr__(self, attribute)
     34             self._fetch()
     35             return getattr(self, attribute)
---> 36         raise AttributeError(
     37             f"{self.__class__.__name__!r} object has no attribute {attribute!r}"
     38         )

AttributeError: 'Redditor' object has no attribute 'note'

Code to reproduce the bug

for mute in reddit.subreddit("test").muted():
    print(f"{mute}: {mute.note}")

My code example does not include the Reddit() initialization to prevent credential leakage.

Yes

This code has previously worked as intended.

Yes

Operating System/Environment

windoze

Python Version

python 3.9.1

PRAW Version

7.4.0

Prawcore Version

2.3.0

Anything else?

Docs here: https://praw.readthedocs.io/en/stable/code_overview/other/subredditrelationship.html#praw.models.reddit.subreddit.SubredditRelationship

@LilSpazJoekp
Copy link
Member

Muted relationships do not have notes (technically they do but they are only retuned in html response on the website). As far as I know only banned and wikibanned have has that attribute (which is why code shows banned).

For the doc example, it is iterating through banned and those do have note attributes.

@LilSpazJoekp LilSpazJoekp closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2022
@computerologist
Copy link
Author

Ack, sorry, wrong link.

https://praw.readthedocs.io/en/stable/code_overview/models/subreddit.html#praw.models.Subreddit.muted

That one shows the code above.

@computerologist
Copy link
Author

@LilSpazJoekp dunno if you see updates after you close an issue

@LilSpazJoekp
Copy link
Member

Ah yep that should be fixed. Do you want to open an PR to fix this?

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

Successfully merging a pull request may close this issue.

2 participants