• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics with the tag "python". Back to normal view
    1. What is the best way to teach Python for my 11-year-old sister that lives in another state?

      This may seem an obvious question, but not as much as it seems. She uses Windows, I’m currently using Linux/macOS. How to instruct her to install her Python environment? Should I use Zoom, Skype,...

      This may seem an obvious question, but not as much as it seems. She uses Windows, I’m currently using Linux/macOS. How to instruct her to install her Python environment? Should I use Zoom, Skype, Google Hangouts, or another solution? Is there and easy way for live-drawing (online blackboard) to explain things to her visually? And, perhaps most importantly, how can I do that for free?

      13 votes
    2. What's the current state-of-the-art in Python package creation/distribution?

      I've been thinking on and off about packaging up a few simple Python utilities I've written to stick up on Github for people to use if they want, but, every time I go to check out how one goes...

      I've been thinking on and off about packaging up a few simple Python utilities I've written to stick up on Github for people to use if they want, but, every time I go to check out how one goes about managing dependencies and all that for a project, I run into a whole wall of options. Does anyone better versed in all of this have any recommendations for me?

      11 votes
    3. Python challenges or projects with just the standard library?

      I've been slowly learning python for some months already. I used the Python Crash Course book from No Starch Press, it teaches the basics and then goes on with some projects with pygame,...

      I've been slowly learning python for some months already. I used the Python Crash Course book from No Starch Press, it teaches the basics and then goes on with some projects with pygame, matplotlib, etc.

      However, I feel that my Python skills aren't very good yet, and before learning to use libraries I would like to have a better command of the standard library.

      I have been looking for some book with projects or, even better, challenges using just the standard library, but haven't found any good ones. Most of them either are for absolute beginners, or use additional libraries, or are very technical and without focus on practice.

      Do you know of any good book or resource with challenges or projects that don't depend on additional libraries? Or, do you have any idea for a project or challenge using just the standard library?

      Thanks in advance!

      14 votes
    4. Tildee — A python library for interacting with Tildes

      Update! After a few hours of struggling I managed to set up Read the docs for Tildee, it should help using the library significantly. After getting some inspiration from TAPS I thought that maybe...

      Update! After a few hours of struggling I managed to set up Read the docs for Tildee, it should help using the library significantly.

      After getting some inspiration from TAPS I thought that maybe I try to work on something vaguely similar on my own. And after… some? hours of coding today I came up with this: tildee.py (source)
      It's a wrapper for the Tildes Public/Web API that is already used by the site internally to make it work. The obvious problem with that is that it will at one point break when this unstable API is changed. It can do basically all things a normal user can do with the notable exception of applying comment labels (because I haven't gotten around to that yet).

      Example of usage for a DM reply bot (result):

      import sys
      from tildee import TildesClient
      import time
      
      # Initialize client and log in, 2FA isn't supported yet and will probably break in horrible ways
      t = TildesClient("username", "password", base_url="https://localhost:4443", verify_ssl=False)
      
      while True:
          # Retrieve the "unread messages" page and get a list of the conversations there
          unread_message_ids = t.fetch_unread_message_ids()
          for mid in unread_message_ids:
              # Access the conversation history page; this also clears the "unread" flag 
              conversation = t.fetch_conversation(mid)
              # Get the text of the last message
              text = conversation.entries[-1].content_html
              # Abort if it's from the current user (I don't think this could actually happen)
              if conversation.entries[-1].author == t.username:
                  break
              print(f"Found a message by {conversation.entries[-1].author}")
              # If the message contains a reference, reply in kind
              if "hello there" in text.lower():
                  print("Replying…")
                  t.create_message(mid, f"General {conversation.entries[-1].author}! You are a bold one.")
              # Delay before processing next unread message
              time.sleep(3)
          # Delay before next unread check
          time.sleep(60)
      

      This has a lot of potential. Haven't yet figured out potential for what, but I'll take what I can get.
      I'd be really grateful if someone with a little more experience than me (that's not exactly a high bar :P) could give me some pointers on the project's structure and the "API design", hence the ask tag. Other creative ideas for what to use this for are appreciated, too.

      47 votes
    5. I'm tracking state sponsored propaganda online, and I need your help.

      Hey, tildes! A few weeks ago, I brought attention to Russian propaganda being shared on reddit. I deleted my reddit accounts, but I'm still tracking propaganda being shared on social media. The...

      Hey, tildes!

      A few weeks ago, I brought attention to Russian propaganda being shared on reddit. I deleted my reddit accounts, but I'm still tracking propaganda being shared on social media. The midterms are approaching quickly, so I'm asking for your help with the project I'm working on.

      1. Help with code: Improve what exists and add more features, heck, even documentation would be an improvement (I'm not a programmer).

      2. Find more propaganda sites: Right, left, Russian, Jamaican, whatever.

      3. Spread the word: Social media, irl friends, media, politicians, etc.

      78,143 reddit posts total.
      16,831 deceptive Russian reddit posts.
      5,588 deceptive Iranian reddit posts.
      1,416 tweets total.

      Here's the full output. Check the 'Overview' tab first.

      Happy to answer questions if you have any.

      44 votes
    6. Coding Noob Needs Help/Guidance on Small Project

      Hi, There's a certain site which hosts media files and has a player that depends on a lot of third-party resources to play, while browsers have native support for those file types. Those 3rd-party...

      Hi,

      There's a certain site which hosts media files and has a player that depends on a lot of third-party resources to play, while browsers have native support for those file types. Those 3rd-party resources are often blocked by ad blockers and I have no desire to white-list them. I would like to extract the direct link to the media file and make it playable on my custom web page.

      The link to the media file is present in the page source of each page, always on the same line. It's not anchored in HTML but present in the JavaScript for the player, like so:

          $(document).ready(function(){
            $("#jquery_jplayer_1").jPlayer({
              ready: function () {
                $(this).jPlayer("setMedia", {
                  [ext]: "https://[domain]/[filename.ext]"
                });
              },
      

      In this example it's on line #5. [ext] = the file extension.

      I want to build the following:

      • A web page with a form with a single input field meant to receive links from that specific file host
      • [Something] that extracts the file link from the source of the host's page
      • Present the linked file as playable in an embedded native player

      So far I've managed to create a form with an input box and a submit button, but it doesn't do anything yet. What is the best way to build the actual functionality? I know HTML/CSS. I have some rudimentary understanding of JavaScript/jQuery and Python3, so those would be my preferred tools.

      For those worried about piracy: The files in question are not copyrighted and I'm not looking to make copies. I just want to make them playable. This is for personal use.

      Thank you for reading this far. Any and all advice is welcome!

      10 votes
    7. Are Python virtual environments comparable to Docker containers?

      I've been trying to understand Docker and while also learning Python it occurred to me that virtual environments seem to be the same thing. They're probably not, but can anyone shed some light on...

      I've been trying to understand Docker and while also learning Python it occurred to me that virtual environments seem to be the same thing. They're probably not, but can anyone shed some light on this?

      6 votes
    8. News Desk Updated!

      A few weeks ago I posted a project I was working on to read news from the command line. I incorporated the suggestions given in that thread (license, requirements.txt, etc), incorporated...

      A few weeks ago I posted a project I was working on to read news from the command line. I incorporated the suggestions given in that thread (license, requirements.txt, etc), incorporated suggestions I've received elsewhere, and added a few features.

      Here's the updated link: News Desk

      Any feedback would be much appreciated!

      Edit: And a specific point for feedback. I store the user's API key in ~/.nd_config/key which I think is a step up from requiring the user to set their key as an environment variable (which is how I had it originally). Still though, is there some way I can not store the key in plaintext and still have it in a format that is readable by the computer and can be used to verify API access?

      7 votes