![]() |
|
[Python] Why does this code doesn't work ? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Why does this code doesn't work ? (/showthread.php?tid=5946887) |
Why does this code doesn't work ? - kookur - Mar 3, 2019 Code import prawWhat i should edit except account username and password for this code to work and reply on the messages ? What is wrong with this code ? RE: Why does this code doesn't work ? - Nachfolger - Mar 3, 2019 (Mar 3, 2019 09:24 AM)kookur Wrote:I have very limited knowledge with Python, but why are you using a continuous loop (while True) and then followed by for loop? Are you trying to keep this code running forever? RE: Why does this code doesn't work ? - Socks. - Mar 3, 2019 Add reddit.inbox.mark_read(unread_messages) outside the for loop then a conditional statement stating that if all messages are marked as read, break the while loop as Nachfolger stated RE: Why does this code doesn't work ? - lockhead - Mar 4, 2019 (Mar 3, 2019 11:41 AM)Nachfolger Wrote: I have very limited knowledge with Python, but why are you using a continuous loop (while True) and then followed by for loop? Are you trying to keep this code running forever? I think he might want to keep it running in the background to automatically respond to incoming messages. Not sure tho. @OP: Can you explain what the code is suppose to do and more importantly what exactly isn't working? If you don't want the program to keep running forever, get rid of the while loop entirely. RE: Why does this code doesn't work ? - vorticalbox - Mar 4, 2019 (Mar 4, 2019 02:26 AM)lockhead Wrote: I think he might want to keep it running in the background to automatically respond to incoming messages. Not sure tho. Doesn't reddit let you listen to events like Twitter api? Doing a while true is going to lock the cpu. RE: Why does this code doesn't work ? - nicodxmus - Mar 4, 2019 This in variables Code unread_messages = []Code for item in reddit.inbox.unread(limit=None): |