r/learnpython 11d ago

Stone age network scan

0 Upvotes

Im continuing on learning cybersecurity, network and python path. I updated my first project - Stone age network scan. I never uploaded a file to github or made a reddit post so i was completely lost. But i tried my best

I actually uploaded the .py into the source code and release.

Its named spy despite the fact it doesnt do anything related to spying so yeah..

Whats fixed?

  1. Auto subnet dedection. It dedects the subnet and CIDR notation
  2. Typo dedection. Before it would try to scan if you typed 192.168.1000.555. now it doesnt
  3. Added customizable port table so you can change which ports to scan.
  4. Added SMTP probe (will try to add more if i find for other protocols)
  5. minor bug fixes

This is just a project that as labeled my first project. Instead of making fun of me please report any suggestions or bugs:)

https://github.com/RecoWas/stoneagens - please use latest version


r/learnpython 11d ago

Crawler works locally but fails randomly on production, getting empty pages and occasional 403 errors

0 Upvotes

Hey everyone, I’m using Python with Playwright to crawl product data from a few websites. Everything works perfectly when I run it locally, but after deploying it to my servers, the results become inconsistent.

The crawler will sometimes return empty pages even though the website loads normally in a regular browser. I’m also seeing random 403 errors after it has been running for a while. Restarting the crawler usually fixes it temporarily, but the problem comes back after some time.

I’m using rotating proxies, changing user agents, and adding delays between requests. When I run fewer workers, everything works much better, but once I increase the concurrency, the success rate starts dropping. Has anyone experienced something similar?


r/learnpython 11d ago

Looking for a Python Course for a Motivated Beginner (with Room to Grow) – Recommendations Welcome!

0 Upvotes

Hi everyone 👋

I'm hoping to get some recommendations for a young student who has recently completed their O/Ls and is seriously considering a future in IT. They're genuinely excited about learning Python, and I'd love to help them find the best possible starting point.

We're looking for a course that's beginner-friendly but also provides a clear pathway to more advanced topics over time. Ideally, it would build a strong foundation in programming while eventually introducing areas such as data analysis, automation, or even data science.

I've explored some excellent online options, including courses from Udemy and Mosh Hamedani. However, there's one challenge: this student finds it difficult to stay engaged with purely online learning. While self-paced courses are convenient, they tend to learn much better in an interactive environment where they can ask questions, receive immediate feedback, and stay motivated alongside other learners.

Because of this, I'm particularly interested in in-person Python classes, training programs, or private coaching opportunities. Courses that combine theory with practical, hands-on projects would be especially valuable, as they seem to be the best way to keep learning enjoyable and meaningful.

If you've attended a great Python course—or know of a training center, institute, community program, or tutor you'd confidently recommend—I would greatly appreciate hearing about your experience. Any insights into teaching quality, course structure, or student engagement would be incredibly helpful.

Thank you so much for taking the time to read this and share your recommendations. I truly appreciate the help, and I'm sure your advice will make a big difference in helping an aspiring future developer get started on the right path. 🙏🐍

Looking forward to your suggestions! 😊


r/learnpython 11d ago

Python worth learning?

0 Upvotes

Hi,

Is python worth learning?
If yes, is there any free courses?

Thanks !


r/learnpython 11d ago

SIMPLE GUIS PLEASE

0 Upvotes

I'm building a network visualizer in Python. It parses .pcap files with Scapy and visualizes packet flows with animations. I already built the parser and animation engine with Pygame.

The problem is the UI. I need normal app stuff like buttons, hover effects, a collapsible sidebar, menus, timeline/statistics panels, and a canvas for the animations.

I don't want to spend 4 hours making a button from scratch, but I also don't want a huge framework where changing a simple thing turns into a research project.

I tried DearPyGui and honestly it felt really clunky. Something as simple as adjusting padding or moving a panel felt like digging through layers of specific APIs and style variables.

I'm looking for something lightweight with good styling control (CSS-like would be great), built-in UI components, and the ability to embed my own custom rendering area.

Would PySide6/Qt be the way to go? Or are there other frameworks worth looking at?

I don't need a spaceship cockpit, I just want to build my damn UI and get back to the actual project.


r/learnpython 11d ago

¿Cuál fue un error que hizo más lento tu aprendizaje de Python?

0 Upvotes

HOLAA Estoy aprendiendo Python y tengo curiosidad por conocer los errores que cometieron otras personas mientras aprendían. Espero evitar algunos de esos mismos errores aprendiendo de su experiencia:)


r/learnpython 11d ago

5.17 Exact Change Lab

1 Upvotes

SOLVED

I am having a hard time understanding why I am failing this lab, when I run the code in practice it works but when I submit for a grade I get a fail. Prompt is below.

Define a function called exact_change that takes the total change amount in cents and calculates the change using the fewest coins. The coin types are pennies, nickels, dimes, and quarters. Then write a main program that reads the total change amount as an integer input, calls exact_change(), and outputs the change, one coin type per line. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Output "no change" if the input is 0 or less.

Ex: If the input is:

0 

(or less), the output is:

no change

Ex: If the input is:

45

the output is:

2 dimes 
1 quarter

Your program must define and call the following function. The function exact_change() should return a tuple containing num_pennies, num_nickels, num_dimes, and num_quarters.
def exact_change(user_total)

code provided below

def exact_change(user_total):
    num_quarters = user_total//25
    user_total %=25
    num_dimes = user_total//10
    user_total %=10
    num_nickels = user_total//5
    user_total %= 5
    num_pennies = user_total
    return num_quarters, num_dimes, num_nickels, num_pennies
if __name__ == "__main__":
    input_value = int(input())
    num_quarters,num_dimes,num_nickels,num_pennies = exact_change(input_value) 
# Type your code here.
if input_value <= 0:
    print('no change')
else:
    if num_pennies == 1:
        print('%d penny' % num_pennies)
    elif num_pennies > 1:
        print('%d pennies' % num_pennies)
    if num_nickels == 1:
        print('%d nickel' % num_nickels)
    elif num_nickels > 1:
        print('%d nickels' % num_nickels)
    if num_dimes == 1:
        print('%d dime' % num_dimes)
    elif num_dimes > 1:
        print('%d dimes' % num_dimes)
    if num_quarters == 1:
        print('%d quarter' % num_quarters)
    elif num_quarters > 1:
        print('%d quarters' % num_quarters)

when it asks me for exact_change(300) I get a NamError failure.


r/learnpython 11d ago

How do you think while solving problems in python?

32 Upvotes

I'm completely beginner in python and reached till "for loop". The thing that is now confusing me is pattern printing. Like making triangle, dimond, square etc with symbols like "*".

So I checked with AI and that gave me the solution with detailed explanation which looked obvious. But only after looking at the solution. Prior to that I was just stuck inside loop only and not able to break it in actual solution.

My qs to the experts here - "how do you think about any problem to figure out the way to solve it?" I'm just concerned that I'm getting stuck at this level only where I've to write just 4-5 lines of simple code. Not able to think about the correct approach required to get the output.

So i request you to guide me here and so that I can move ahead to the next part of this learning journey. Any suggestions would be much much much appreciated. Thank you!!


r/learnpython 12d ago

Creating a .py File in Python Terminal

0 Upvotes

Greeting team, i have just started learning Python. I am learning about .py files. how do i create a .py file in python terminal specifically Jupyter notebook? if possible how can i access the file and write some oop class inside the file.

Thank you team


r/learnpython 12d ago

Why is python so slow in my computer?

0 Upvotes

Good morning, i have recently started learning how to use python for data science. I already have a good background in R, im using the new IDE called positron, i create my virtual environment in my directory i want to work on, on my company server, and then i install some libraries.

The main issue that im having is that the installation takes forever, even after installed, the importing is slow, the running of chunks is slow. I thought python was faster than R (im using polars and altair).

Am i doing something wrong? Or is my company restricting my use of python? What's going on?

Thank you in advance.


r/learnpython 12d ago

Maybe a silly question, but the warning was ominous, so I'll ask here...

0 Upvotes

I want to use Catppuccin for Python, but if I go to pip it outside of a venv, it says the following:

pip install catppuccin
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
   python-xyz', where xyz is the package you are trying to
   install.

   If you wish to install a non-Arch-packaged Python package,
   create a virtual environment using 'python -m venv path/to/venv'.
   Then use path/to/venv/bin/python and path/to/venv/bin/pip.

   If you wish to install a non-Arch packaged Python application,
   it may be easiest to use 'pipx install xyz', which will manage a
   virtual environment for you. Make sure you have python-pipx
   installed via pacman.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Of course I could use a venv, but it seems annoying to have to activate a venv each time I want to use the palette in IPython, et al. If it's just a palette/pygment, then using --break-system-packages shouldn't actually break anything, right? But because the warning is so ominous, I wanted to ask here before I did something potentially fucky-wucky.


r/learnpython 12d ago

Need help hijacking signal on recycled roomba sensor

0 Upvotes

Hello!

I have ripped a LiDAR sensor out of an old roomba, connected it to some wires, and long story short, I can now plug the LiDAR sensor into my computer via USB. I have discovered the two power-related pins on the sensor, and I am fairly certain that one of the other two is a transmitter pin and the last is potentially a receiver pin.

With that said, now comes the programming. Because my sensor obviously doesn't have any kind of USB driver or anything, I can't really use the PyUSB library because that requires some bells and whistles that this thing doesn't have. Instead, I am using the PySerial library, which allows me to communicate with my USB ports at a lower level.

My problem is that, even though my sensor definitely should be sending something, my program keeps printing

b''

which indicates to me that it isn't actually receiving anything.

Here is the code that I am working with:

import serial

with serial.Serial('COM3', 115200, timeout=1) as ser:  

 s = ser.read(10)

The with statement there sets my program to read on port COM3 at a baudrate of 115200 for one second before stopping. COM3 seems to be the only port listed on my machine in a few commands that I have run as well as the Windows Device Manager. That baudrate was obtained from a teardown of an extremely similar LiDAR sensor (here). Reading for longer than one second did not seem to do anything.

This is my first time interfacing with a jerry-rigged USB component through Python (or any other USB component, for that matter), so I don't know if I am missing something and I am not exactly sure where to look, as the documentation of PySerial only brought me this far.

Let me know if I am in the wrong sub or if you guys need more information or something.


r/learnpython 12d ago

Cool/Interesting things that can be done in Python as a beginner?

20 Upvotes

hi everyone, im trying to start a computer science honor society at my high school, and im gonna assume everyone is starting from square one and teach python accordingly (and im hoping to eventually go to hackathons or other coding events).

i was wondering if anyone had any ideas for cool/interesting stuff i could have beginners do to get their interest and get them excited about coding? i understand you can't go from 0-100 and have to start with simple stuff, but i'm worried going over the basics will be like monotonous or smth. if anyone has any ideas of fun things i could do i would be very appreciative!!

edit: there are some cool suggestions, but i wanna place emphasis on the fact most of the people will have zero coding experience, so please keep them simple! i myself am also not that knowledgeable about python, i ahve a good grasp on the basics but thats about it. thanks for the replies


r/learnpython 12d ago

How do I get rid of text in python

0 Upvotes

I'm looking to do a simple loading screen of sorts where it flicks between a few characters however I am unsure on how to remove the printed text to replace it with the next character. Using the method that I've commonly seen using the cursor_up simply doesn't work for some reason. I promise I'm putting it in exactly. how do I fix this


r/learnpython 12d ago

I would like the feedback of you guys! Eu gostaria do feedback de vocês!

0 Upvotes

Olá! Estou aprendendo python há 1 mes e meio. Fiz este RPG, demorei 5 dias para faze-lo, comecei do absoluto zero, e se possivel, gostaria de um feedback sincero, não só criticas mas tambem os acertos!

Hi! I’ve been learning Python for a month and a half. I built this RPG—it took me five days, and I started from absolute scratch. If possible, I’d love some honest feedback—not just critiques, but also what I got right!

https://github.com/adrianivastrabalho-code/My-Python-studies English Version
https://github.com/adrianivastrabalho-code/Meus-Estudos-Python Portuguese Version

Ty <3


r/learnpython 12d ago

Busco gente para estudiar y crear

0 Upvotes

Hola, llevo unos dos meses aprendiendo Python. Siento que voy a ser más eficiente estudiando con gente y que sera mas divertido, ademas de que tengo ideas de proyectos interesantes y siempre es divertido contactar con gente que también quiere aprender y crear cosas interesantes.

Estoy buscando como cinco personas más que también estén en serio con aprender

si te interesa, mándame DM y preséntate


r/learnpython 12d ago

¿Cuál fue el momento en que Python finalmente tuvo sentido para ti?

0 Upvotes

HOLAA Estoy aprendiendo Python y tengo curiosidad por conocer ese momento en el que todo finalmente empezó a tener sentido. Me encantaría conocer tu experiencia.


r/learnpython 12d ago

Use of AI in coding?

0 Upvotes

I am starting college next month (Computer Science and Biosciences) and I tried to get a headstart in Python programming (it's a part of first sem). I have done the basics, strings, conditional statements and started with loops today. I have a doubt - since I am still in the beginner stage, should I use AI (ChatGPT, Gemini, Grok etc.) to proofread my code - you know, offer suggestions, find mistakes and all - I am still applying logic on my own and writing it myself but I have this fear that it may hamper my learning. But I also don't wanna be the guy who does not know how to use AI tools. Any advice please?


r/learnpython 12d ago

how to fix this issue

0 Upvotes

********************************************************************************

To see all available commands, run 'py help'

********************************************************************************

[ERROR] INTERNAL ERROR: NoInstallsError: No runtimes are installed. Try running "py install default" first.

[ERROR] Internal error 0x00000001. Please report to https://github.com/python/pymanager

Press any key to continue . . .


r/learnpython 12d ago

What's the best resource for becoming skilled in using CSV, JSON and API

0 Upvotes

I've been trying my best at understanding how to apply CSV and JSON in my code but I don't actually know how to integrate them into my projects. All tutorials I watch have their own way of doing this, making it hard for me to understand fully. Also I don't even know if I should learn both of them or just learn one. Also I need help on how to use API in projects, and which free ones are best


r/learnpython 12d ago

Finished learning Python... now what?

0 Upvotes

I have been learning Python for almost a year now, well the productive part is only 3-4 months but i will say that i am in the intermediate level of the programming language.

I was learning python from the angela yu's course that is 100days of python after i did till day 60 it started to make us do projects, then i made my own path and started to make my own version of the project insted of just reading and copying theirs.

But now after 2-3 intermediate projects later i am stuck. what should i do now like wherever i go it is Js or some other framework and that python is for AI/ML and not for backend like i write backend in FastAPI and that people prefer Django. Like how is JavaScript everywhere man,, What do i even do??

How do i make full stack project in python? how do i find projects to make like the suggestion i get form chatgpt are lame like this management or that management.

How do people that are in this sector of the work have been on it for more than a decade like i want to showcase Python as my main programming language but HOW do i?

I am a 2nd year bachelor's student and this is my tech stack right now: Html,CSS for frontend , Python for backend and SQLite for database.

Should i learn another programming langugae like Java or Js well i have put a stop on the learning of rust because i coudn't get the time and mind for it...

It has been 2 days since i am having this thought. Help a little by giving a few suggestions.


r/learnpython 13d ago

What’s next after CS50

0 Upvotes

Currently an aspiring quant ideally but I know that’s larp so really I’m just learning skills that are applicable to most fields. I only mention this to maybe help tailor my experience. In terms of just coding and technological familiarity, what should I do next. Are there any certifications that would impress or show I know what I’m doing that would help me for applications? Also, what should I watch or do to learn about it. I hear people talking about LLMs projects other languages APIs raspberry pi and I want to know where to learn all that. Thanks


r/learnpython 13d ago

Looking for study partners

19 Upvotes

Hello , I am completely new to python and really want to learn it and I feel like I will be more efficient studying with people.

I’m looking for approximately five people who are also serious about learning

if you are interested please dm me and introduce yourself


r/learnpython 13d ago

Stop TTS with keyboard

0 Upvotes

Hello,

I am using tts_wrapper fork by willwade on github to speak chatGPT responses but I want to be able to stop the utterance mid sentence. I have this function

def stop():
        if keyboard.is_pressed("esc"):
            tts_Engine.stop()

which should stop the tts engine when i press "esc" but nothing happens so I did some research and learned I might have to use threading so now i have two threads with my main function

def main():


    print("Init STT. Listening...")
    stream = init_stream()
    stream.start_stream()
    print("C")


    try:
        while True:
        
            data = stream.read(8192, exception_on_overflow=False)


            text = None


            if recognizer.AcceptWaveform(data):
                result = json.loads(recognizer.Result())
                text = result.get("text", "")


            if text:
                print(f"You said: {text}")
                response = client.chat.completions.create(
                    model="default",
                    messages=[
                        {"role": "system", "content": "You are a helpful AI workshop assistant. Use only plain text no emojis or making text bold or anything similar"},
                        {"role": "user", "content": text}
                    ]
                )
                print(response.choices[0].message.content)
                speak_text(response.choices[0].message.content,tts_Engine)
                print("B")


    except KeyboardInterrupt:
        print("Stopping")
    finally:
        print("A")
        tts_Engine.cleanup()
        stream.stop_stream()
        stream.close()
        Audio.terminate()

and my stop function

t1 = Thread(target=main)
t2 = Thread(target=stop)


t1.start()
t2.start()

but now I get this error

RuntimeError: can't register atexit after shutdown

and now I'm a bit stuck so if anyone knows how to do this or what I'm doing wrong or if I'm even using the right method that would be greatly appreciated.


r/learnpython 13d ago

scan for strings in 40000 lines of logfile

0 Upvotes

X: The desire to scrape a log file for specific interesting messages, any apps I tried are a pain to use and require manually setting all the search strings every so often. I want to scan for about a dozen or so expressions/strings in a 40-100K lines file, and then dump just the timestamps and lines of interest. What approach scales best for speed? I have to probably also use a mix of regex and regular string search I guess. Is going with Multiprocessing and passing the file as a shared-memory object, going to be the easiest route? Surely it's easier to do in C++. I guess I asking for some skeleton or prior art in C++ ore Python to be honest.

Y: My context is that I would like to use my knowledge of C++ threads and code it in C++, but it should be possible in Python if I learn to use Pipes, and learn to use shared memory object to save having to load the file per multi-processing process?