


Because of this, using sudo is an understandable default. Installing programs and libraries usually requires it, editing system files requires it, but tweaking things in your home directory never does unless you have written a script or program that does one of those. The frustrating thing about learning the Linux command line for me was that not everyone makes it clear when something like sudo is necessary. Then you can drop the file extension completely and just run the script by typing "thought". An extra bonus is adding "#! /usr/bin/python" or "#! usr/bin/env python" as the first line of your script. Also, if you make the script executable (chmod +x thought.py) you can run the script without typing "python" at the beginning. Also, unless you are saving the script outside of your home directory (which is your console's default location, you can launch nano without using sudo as well. Nice to see you taking the steps to learn! The script should run with just "python thought.py". Depending on how you display this you may need to adjust it. I picked 32 so the text doesnt scroll too far in the screen. We use textwrap so that after 32 characters it starts a new line. Im calling this bot Showerthoughtbot 0.1, but if this stops working we will need to rename it. Your top 5 posts: 'In the shower I decided I want a flatter penis. According to the Reddit api we need to identify ourselves by putting in a User Agent. 1 Posted by u/AutoModerator 5 months ago Happy Cakeday, r/AskShowerThoughts Today you're 8 Let's look back at some memorable moments and interesting insights from last year. We will be getting the hot posts, which is the best recent posts. We skip post 0 since that is just an announcement for the subreddit This will be used later to get a random post. Next we will need a way to get a random number between 1 and 20, we will call this value randompost. First we need to import some modules to the program.
