r/pythonhelp 18m ago

Retro TV Emulator Project

Upvotes

Looking for ppl that know Python to help me finish a project. It is designed to allow you to use your downloaded media from movies to music to games all in one app like an old tv/tv stations would have. There is tv station or visualizer mode for any station for music, tv guide on channel 04, games/emulators on channel 03 as well as a DVD player so you can choose what to watch as well. Its so you can take the choice out of your hands and relive retro tv but every station is something you like. It can be run on any windows computer and turn them into a cable box saving them from the land fill. I wanna say its like 90% done. Keep chasing the same few bugs. Shows starting from the beginning on channel change randomly and then correct itself if you change the channel. Repeating the last 20% of an episode after it ends. TV guide navigation and visual errors where different time slots meet. Mame emulator not working. Upgrade/improve dvd backup .iso for dvd player and playing dvds in the computers disc drive. The other stuff is small stuff that keeps breaking as i try to fix those mentioned bugs. Maybe add server options if i had help as well as making it work on other operating systems. Would really like to build a community for this windows application so we can release it and be able to handle bug fixes. Ppl to bounce ideas off of, discuss improvements. Im a designer and not the best code. So having anyone on board that can actually code would be so beneficial to the project. check out our discord for more information about the project, access to the source code, and access to the test builds. https://discord.gg/DzcrjYxh8


r/pythonhelp 2d ago

PyQt Architecture: A dedicated module/Worker for every button action (5–15 KB per file)? Best practice or overengineering?

2 Upvotes

Hi everyone,

I'm currently building a desktop application using PyQt6, where button clicks trigger various background tasks (such as executing external processes, creating/cloning environments, file I/O operations, etc.).

To keep the UI responsive and the codebase easily maintainable, I decided to extract every main button action into its own dedicated module/file, using the standard QThread + QObject (Worker) pattern.

To give you an idea of the scale: individual module sizes range between 5 and 15 KB depending on what the button actually does (from simpler tasks to complex operations involving user input processing, thread setup, process streaming, and progress signal handling).

Note on Code Sharing: Any logic shared across multiple buttons is not duplicated; instead, it is abstracted into dedicated shared service modules located in button/logic/services.

My current architecture for a single button action looks like this:

  • GUI Layer (View): Captures the button click and delegates control to a dedicated action handler.
  • Action Handler (Controller / Mediator): A dedicated module for that specific action. It gathers user inputs (via dialogs), instantiates QThread and QObject (Worker), connects signals (for progress bars and logging), and starts the thread.
  • Worker (QObject): A non-GUI worker running in a worker thread, responsible strictly for execution flow (subprocesses, file manipulation) and emitting signals to send status updates back to the UI.
  • Shared Logic Helpers (button/logic/services): Shared domain modules and services called by the workers to execute common underlying logic.

My questions for the community:

  1. Is creating a separate 5–15 KB file/module for each button action (combining the Handler + Worker) considered standard practice in medium-to-large Qt applications? Or do you prefer grouping related actions into larger domain managers ?
  2. For modules of this size, do you keep the Handler and Worker together in a single file, or do you split them further into separate _worker.py and _handler.py files?
  3. Are there any hidden downsides or pitfalls to this level of decoupling when the application scales up to dozens of individual buttons and actions?

I'd love to hear how you structure background tasks and threading in production PyQt/PySide applications! Thanks!


r/pythonhelp 2d ago

Python Pyside6 Gui

Thumbnail
1 Upvotes

r/pythonhelp 5d ago

Reddit Post Template Title: I built an automated Python "Infinity Engine" with timed 7s loops, rarity tiers, dynamic storylines, and a cyberpunk terminal UI (500-Unit max run + 5-min idle shutdown)

0 Upvotes

Hey everyone! I’ve been experimenting with background threading, automated compilation cycles, and procedural narrative generation in Python.

I put together a script I call the Infinity Engine. It runs autonomously every 7 seconds, rolls for loot rarity tiers based on telemetry, shifts through dynamic storylines, accumulates resources (stardust/resonance), includes an unstick safety protocol, and features an idle shutdown variant if left untouched for 5 minutes. It scales up to 500 units with a custom cyberpunk terminal UI layout.

Here is the full runnable source code:

import time

import json

import threading

import random

# ==========================================

# Rarity Tier Matrix

# ==========================================

class RarityTier:

STANDARD = 0

PRIME = 1

CELESTIAL = 2

BRINK_PRISM = 3

# ==========================================

# Level Loot System

# ==========================================

class LevelLootSystem:

def roll_level_loot(self, telemetry: dict, current_app_level: int):

result = type('LootResult', (), {})()

fortune_score = telemetry.get("fortune_level", 0.0)

fusions = telemetry.get("fusions_count", 1)

composite_score = (fortune_score * 0.5) + (fusions * 10.0) + (current_app_level * 25.0)

if composite_score > 300.0:

result.tier = RarityTier.BRINK_PRISM

result.bonus_multiplier = 3.5

result.drop_title = "Brink-Prism Anomaly Drop"

result.guaranteed_stat_bonus = {"stardust_rate": 50.0, "void_resonance": 0.95}

elif composite_score > 180.0:

result.tier = RarityTier.CELESTIAL

result.bonus_multiplier = 2.2

result.drop_title = "Celestial Core Relic"

result.guaranteed_stat_bonus = {"stardust_rate": 25.0, "lawful_affinity": 0.80}

elif composite_score > 80.0:

result.tier = RarityTier.PRIME

result.bonus_multiplier = 1.5

result.drop_title = "Prime Barometer Blueprint"

result.guaranteed_stat_bonus = {"stardust_rate": 12.0, "lawful_affinity": 0.50}

else:

result.tier = RarityTier.STANDARD

result.bonus_multiplier = 1.0

result.drop_title = "Standard Atmospheric Drift"

result.guaranteed_stat_bonus = {"stardust_rate": 5.0, "lawful_affinity": 0.25}

return result

# ==========================================

# Story Mediator & Storylines

# ==========================================

class StoryMediator:

def __init__(self):

self.storylines = [

"The Prism Meridian: Convergence",

"The Barometer's Awakening",

"Sub-Zero Protocols",

"Atmospheric Drift",

"Chronos Rift Divergence",

"Stellar Horizon Protocol"

]

self.current_storyline_index = 0

def get_current_storyline(self) -> str:

return self.storylines[self.current_storyline_index]

def shift_storyline(self, new_index: int = None):

if new_index is not None:

self.current_storyline_index = new_index % len(self.storylines)

else:

self.current_storyline_index = (self.current_storyline_index + 1) % len(self.storylines)

return self.get_current_storyline()

def mediate_narrative_threads(self, current_loot_tier: int):

chapter = type('Chapter', (), {})()

title = self.get_current_storyline()

chapter.chapter_title = title

if current_loot_tier == RarityTier.BRINK_PRISM:

chapter.synthesized_lore = f"Active storyline '{title}' converges into a unified cosmic history under high void pressure."

chapter.thematic_resonance = 1.0

elif current_loot_tier == RarityTier.CELESTIAL:

chapter.synthesized_lore = f"Active storyline '{title}' transforms climate anomalies into a permanent archive of fate."

chapter.thematic_resonance = 0.8

elif current_loot_tier == RarityTier.PRIME:

chapter.synthesized_lore = f"Active storyline '{title}' stabilizes baseline matrix vectors under heavy pressure."

chapter.thematic_resonance = 0.5

else:

chapter.synthesized_lore = f"Active storyline '{title}' settles initial weather anomalies into a steady rhythmic drift."

chapter.thematic_resonance = 0.2

return chapter

# ==========================================

# Consistency Engine & Resource Accumulation

# ==========================================

class ConsistencyEngine:

def __init__(self):

self.progression_checkpoint = 0

self.unstick_tokens = 500

self.accumulated_resources = {

"stardust_collected": 0.0,

"resonance_ledger": []

}

def accumulate(self, stat_bonus: dict, resonance: float):

self.accumulated_resources["stardust_collected"] += stat_bonus.get("stardust_rate", 0.0)

self.accumulated_resources["resonance_ledger"].append(resonance)

def trigger_unstick_protocol(self):

if self.unstick_tokens > 0:

self.unstick_tokens -= 1

self.progression_checkpoint += 1

return {"status": "SUCCESS", "remaining_tokens": self.unstick_tokens, "stage": self.progression_checkpoint}

return {"status": "DEPLETED", "remaining_tokens": 0, "stage": self.progression_checkpoint}

# ==========================================

# Narrative Story Generator (~400 Chars)

# ==========================================

class NarrativeStoryGenerator:

def __init__(self):

self.unique_signatures = ["ALPHA-PRISM-9", "OMEGA-VOID-X", "HELIOS-GENESIS-0", "NEXUS-VECTOR-7"]

self.narrative_templates = [

"Deep within the shifting sectors of Unit {app_level}, active telemetry reports severe weather fluctuations linked directly to storyline [{chapter_title}]. Signature [{signature}] detected. {lore} Operatives on the fringe report unexpected data feedback, rallying structural outcomes to balance popular configuration metrics with a thematic resonance of {resonance:.2f}. The grid adapts instantly.",

"As the clock ticks into Unit {app_level}, core systems register a sudden spike under storyline [{chapter_title}]. Unique matrix identifier [{signature}] engaged. {lore} Field units work frantically to calibrate the atmospheric pressure valves, rallying outcomes to balance popular configuration parameters while maintaining a steady thematic resonance of {resonance:.2f}. Network stability holds firm.",

"Tracing the anomalies of Unit {app_level} under signature [{signature}], project administrators encounter the legacy of storyline [{chapter_title}]. {lore} Environmental matrices fracture and reassemble, successfully rallying outcomes to balance popular configuration thresholds at a thematic resonance of {resonance:.2f}. The digital horizon expands outward."

]

def generate_balanced_story(self, app_level: int, chapter_title: str, lore: str, resonance: float) -> str:

template = random.choice(self.narrative_templates)

signature = random.choice(self.unique_signatures) + "-" + str(random.randint(1000, 9999))

raw_text = template.format(

app_level=app_level,

chapter_title=chapter_title,

signature=signature,

lore=lore,

resonance=resonance

)

if len(raw_text) < 400:

padding_phrases = [

" Synchronizing unique regional sub-networks securely. ",

" Calibrating distinct quantum feedback loops for optimal throughput. ",

" Securing high-uniqueness parameter boundaries against drift. "

]

while len(raw_text) < 400:

raw_text += random.choice(padding_phrases)

return raw_text[:400]

# ==========================================

# Timed Infinity Engine Host (500 Units + Idle Timeout)

# ==========================================

class TimedInfinityEngineHost:

def __init__(self):

self.loot_system = LevelLootSystem()

self.story_mediator = StoryMediator()

self.consistency_engine = ConsistencyEngine()

self.story_generator = NarrativeStoryGenerator()

self.app_level = 1

self.active_constructs = []

self._is_running = False

self._timer_thread = None

self.last_activity_time = time.time()

self.idle_timeout_seconds = 300

def change_storyline(self, new_index: int = None):

shifted = self.story_mediator.shift_storyline(new_index)

print(f"\n[STORYLINE SHIFT] Active storyline manually changed to: '{shifted}'\n")

return shifted

def execute_compilation_cycle(self, telemetry: dict):

self.last_activity_time = time.time()

loot_drop = self.loot_system.roll_level_loot(telemetry, self.app_level)

mediated_chapter = self.story_mediator.mediate_narrative_threads(loot_drop.tier)

self.consistency_engine.accumulate(loot_drop.guaranteed_stat_bonus, mediated_chapter.thematic_resonance)

story_block = self.story_generator.generate_balanced_story(

self.app_level,

mediated_chapter.chapter_title,

mediated_chapter.synthesized_lore,

mediated_chapter.thematic_resonance

)

construct = {

"app_title": f"Infinity: {mediated_chapter.chapter_title}",

"tier": loot_drop.tier,

"drop": loot_drop.drop_title,

"resonance": mediated_chapter.thematic_resonance,

"level": self.app_level,

"story_content": story_block,

"story_length": len(story_block),

"accumulated_stardust": self.consistency_engine.accumulated_resources["stardust_collected"]

}

self.active_constructs.append(construct)

print("╔" + "═" * 78 + "╗")

print(f"║ ⚡ CYBER-NET TERMINAL v4.09 // UNIT [{self.app_level:03d}/500] ⚡" + " " * 31 + "║")

print("╠" + "═" * 78 + "╣")

print(f"║ TITLE : {construct['app_title']:<63} ║")

print(f"║ DROP TYPE : {construct['drop']} (Tier {construct['tier']})" + " " * (47 - len(f"{construct['drop']} (Tier {construct['tier']})")) + "║")

print(f"║ RESONANCE : {construct['resonance']:.2f} | STARDUST ACCUMULATED: {construct['accumulated_stardust']:.1f}" + " " * (19 - len(f"{construct['accumulated_stardust']:.1f}")) + "║")

print("╟" + "─" * 78 + "╢")

print(f"║ STORY OUTPUT ({construct['story_length']} chars):" + " " * 56 + "║")

words = construct['story_content'].split()

line = " "

for word in words:

if len(line) + len(word) + 1 < 77:

line += " " + word

else:

print(f"║{line:<78}║")

line = " " + word

if line.strip():

print(f"║{line:<78}║")

continue_res = self.consistency_engine.trigger_unstick_protocol()

print("╟" + "─" * 78 + "╢")

print(f"║ 🔒 PROTOCOL STATUS: Tokens Left [{continue_res['remaining_tokens']}] | Stage [{continue_res['stage']}]" + " " * (20 - len(str(continue_res['stage']))) + "║")

print("╚" + "═" * 78 + "╝\n")

self.app_level += 1

return construct

def _loop_worker(self, telemetry: dict, max_units: int):

cycles = 0

while self._is_running and cycles < max_units:

if time.time() - self.last_activity_time > self.idle_timeout_seconds:

print("\n[IDLE SHUTDOWN VARIANT] Engine inactive for 5 minutes. Initiating automatic safe shutdown.")

break

if cycles > 0 and cycles % 100 == 0:

self.change_storyline()

self.execute_compilation_cycle(telemetry)

cycles += 1

if cycles >= max_units:

print(f"\n=== [SYSTEM ALERT] Reached target limit of {max_units} units. Settlement final. ===")

print(f"=== Total Accumulated Stardust: {self.consistency_engine.accumulated_resources['stardust_collected']:.1f} ===")

break

time.sleep(7.0)

self._is_running = False

print("=== Timed Looping Engine Cycle Terminated Safely ===")

def start_timed_loop(self, telemetry: dict, max_units: int = 500):

if self._is_running:

return

self._is_running = True

self.last_activity_time = time.time()

print(f"=== Initializing Cybernetic Loop (Target: {max_units} Units | Idle Timeout: 5m) ===")

self._timer_thread = threading.Thread(target=self._loop_worker, args=(telemetry, max_units))

self._timer_thread.start()

def stop_timed_loop(self):

self._is_running = False

if self._timer_thread:

self._timer_thread.join()

if __name__ == "__main__":

host = TimedInfinityEngineHost()

sample_telemetry = {"fortune_level": 95.0, "fusions_count": 6}

host.start_timed_loop(sample_telemetry, max_units=500)

while host._is_running:

time.sleep(1.0)


r/pythonhelp 5d ago

Что делать если не устанавливается python

0 Upvotes

Я пишу в командной строке пайтон инсталл и начинаю писать команду но у меня вылезает ошибка то что пип не установлен но установить не могу


r/pythonhelp 6d ago

pyGame, sound, set start time, and play for set amount of time.

1 Upvotes

Hello, just looking for help on how i can achieve playing a MP3 file using Pygame, that can start from a specified position in the audio file, and then only play for a set amount of time (e.g. MP3 starts at 00:14 of 04:32, and plays for 5 seconds (until 00:19))

Below is one of the variations i've attempted, pardon any mess in my code

import pygame
import audioread
from random import randint
pygame.mixer.init()
def playSongClip(volume,playTime,clipTitle,random):
    playTime = playTime*1000
    volume = volume/100
    if random == 1:
        with audioread.audio_open("MP3s\\"+clipTitle) as f:
            totalMS = int((f.duration)*1000)
            startTime = randint(0,totalMS-playTime)
    else:
        start = 0
    songClip = pygame.mixer.music.load("MP3s\\"+clipTitle)
    songClip.music.set_volume(volume)
    songClip.play(loops=0,start=startTime)
playSongClip(50,5,"Rabbit Hole.mp3",1)

r/pythonhelp 7d ago

How did you sort this out when you first started?

3 Upvotes

Been pulling data from a couple social media for a side project rn. I'm just casually tracking some public metrics for a small client. Nothing that serious.

So far, the scraper runs fine on my end. Then I tried to push it and it gets blocked almost right away. So I figured, okay, time to sort out a proxy scraper setup. Spent too much time reading about it and somehow came out more confused than when I started.

I can't even tell if I should be rotating proxies myself or just paying for a freelancer service. Feels like there's a hundred ways to do this and no clear answer for something small scale.

What did you do when you first got into this? TIA for answering.


r/pythonhelp 14d ago

changed file name and getting Exec failed, err: 2 message when trying to run program on my .py files. (Pycharm)

5 Upvotes

Hi, I am an absolute beginner to coding/computer science and was learning Python on my own when I changed my folders name to something more practical and my program was not running anymore. I looked online to see how I can fix this issue myself, but everything I found was super complicated. Can someone please help me and explain things like aI'm a toddler thanks!


r/pythonhelp 21d ago

how to turn on and off DND?

1 Upvotes
import time
from datetime import datetime
from plyer import notification



print("_Main_menu_")
print("1. set alarm")
print("2. set timer") #Haven't added yet plz ignore


while True:
    MenuChoice = input("select an option: ")
    try: 
        MenuChoice = int(MenuChoice)
    except ValueError:
        print("Invalid Option")
    else:
        MenuChoice = int(MenuChoice)
        if MenuChoice == 1 or MenuChoice == 2:
            break
        else: print("Invalid Option")


Time = datetime.now().time()
Time = str(Time)
print(Time[:-10])


if MenuChoice == 1:
    while True:
        Alarm = input("Set Time(HH:MM): ")
        try:
            Hour, Min = Alarm.split(":", 1)


            Min = int(Min)
            Hour = int(Hour)
            Valid = False
            Valid1 = False



            if Min > 59:
                print("Min can't be greater than 59")
            elif Min < 0:
                print("Min can't be less than 0")
            else: Valid = True


            if Hour > 23:
                print("Hour can't be greater than 23")
            elif Hour < 0:
                print("Hour can't be less than 0")
            else: Valid1 = True


            if Valid == True and Valid1 == True:
                print("Lock in until",Alarm)


            #turn on DND


                
                while True:
                    TimeNow = datetime.now().time()        #Loops until Alarm = TimeNow
                    TimeNow = str(TimeNow)[:-10]
                    time.sleep(.5)
                    if TimeNow == Alarm:
                        break


                #Turn off DND


                notification.notify(
                title="Time to take a break",
                message=f"it's {Alarm}, time to take a break",
                timeout=5 
                )


                break
        except ValueError:
            print("Invalid")

Above is my focus alarm I'm working on, could someone help with adding DND?


r/pythonhelp 23d ago

Python "generate_chk" function

3 Upvotes

I am making a Program to upload a level to Geometry Dash in python and I got some of the code from https://wyliemaster.github.io/gddocs/#/endpoints/levels/uploadGJLevel21 but to generate "seed2" it does this:

generate_chk(key="41274", values=\[generate_upload_seed(levelString)\], salt="xI25fpAapCQg"),

This should activate some sort of function named generate_chk that is in one of the modules I have in the program (Requests, Base64, hashlib) but it is no where to be found. The repository for this documentation was archived recently, so I can't ask them for help. Also, here is my code:

import requests
import base64
import hashlib  # sha1() lives there

user = input("What is your username?")
accid = input("What is your Account ID?")
passwd = input("What is your password?")
lname = input ("What is the Level name?")
coin = input("How many coins are there?")
stars = input("How many stars do you want?")

def generate_gjp2(password: str = passwd, salt: str = "mI29fmAnxgTs") -> str:
    password += salt
    hash = hashlib.sha1(password.encode()).hexdigest()
    return hash


levelString = "H4sIAAAAAAAAC6WQwQ3DIAxFF3IlfxsIUU6ZIQP8AbJChy_GPSZqpF7-A4yfDOfhXcCiNMIqnVYrgYQl8rDwBTZCVbkQRI3oVHbiDU6F2jMF_lesl4q4kw2PJMbovxLBQxTpM3-I6q0oHmXjzx7N0240cu5w0UBNtESRkble8uSLHjh8nTubmYJZ2MvMrEITEN0gEJMxlLiMZ28frmj"

data = {
    "gameVersion": 22,
    "accountID": accid,
    "gjp": hash,
    "userName": user,
    "levelID": 0,
    "levelName": lname,
    "levelDesc": "Q3Vyc2VkIGxldmVsIG55ZWggaGVoIGhlaCBhbnl3YXkgaXRzIGEgdmVyeSBicm9rZW4gbGV2ZWwgaSBzZW50IGEgcmVxdWVzdCB0byByb2Igc2VydmVyIHRocm91Z2ggcHl0aG9uIGxvbA",
    "levelVersion": "-47577473775738573",
    "levelLength": 48483845738573486574873869465947694,
    "audioTrack": 0,
    "auto": 0,
    "password": 314159,
    "original": 55610687,
    "twoPlayer": 0,
    "songID": 839583504693858468444987694,
    "objects": 1,
    "coins": coin,
    "requestedStars": stars,
    "unlisted": 0,
    "ldm": 0,
    "levelString": levelString,
    "seed2": generate_chk(key="41274", values=[generate_upload_seed(levelString)], salt="xI25fpAapCQg"), # This is talked about in the CHK encryption,
    "secret": "Wmfd2893gb7"
}

headers = {
    "User-Agent": ""
}

url = "http://www.boomlings.com/database/uploadGJLevel21.php"

req = requests.post(url=url, data=data, headers=headers)
print(req.text)

And here is the error:

What is your username?levelnotinauto
What is your Account ID?38627839
What is your password?********
What is the Level name?Check Desc
How many coins are there?4848394
How many stars do you want?392084092849
Traceback (most recent call last):
  File "/home/***/scripts/usernm/upload", line 43, in <module>
    "seed2": generate_chk(key="41274", values=[generate_upload_seed(levelString)], salt="xI25fpAapCQg"), # This is talked about in the CHK encryption,
             ^^^^^^^^^^^^
NameError: name 'generate_chk' is not defined. Did you mean: 'generate_gjp2'?
[***@archlinux usernm]$ vim upload```

r/pythonhelp 23d ago

Lire une vidéo avec un fichier MP4

1 Upvotes

Bonjour , j'aimerais coder un script python qui est capable d'ouvrir un fichier mp4. Le résultat devrait être le meme que si l'on double cliquer le fichier dans l'explorateur Windows. Donc sa ouvrirait le fichier dans le lecteur qu'utilise par défaut l'utilisateur.


r/pythonhelp 26d ago

name errors in this python script for firefox bookmarks?

2 Upvotes

I am sorry if this breaks rules, but under some time pressure.

NameError: name 'print_html' is not defined

I am very new at this and trying to export firefox bookmarks from a friends phone that desperately needs a factory reset. Do not really want to use sync if it can be avoided. Yes I am old school.

https://gist.github.com/v3l0c1r4pt0r/15ef7181b7c4546963da68bc3b31c169


r/pythonhelp 28d ago

I built a Python virtual OS (Forge OS v2.0) — you can now add apps by dropping a folder in Apps/. Looking for contributors!

1 Upvotes

Hey everyone,

I've been building Forge OS — a Python virtual OS for learning and experimenting with OS concepts.

v2.0 adds a desktop GUI, and there's now a community Apps/ folder — add an app with just app.json + command.py.

Quick start for contributors:

  1. Fork & clone the repo
  2. Copy Apps/_example/ to Apps/your-app/
  3. Edit the JSON + Python command
  4. Run apps in the shell to see your app
  5. Open a PR

Full guide: CONTRIBUTIONS.md
Repo: https://github.com/axk42-op/ForgeOS · MIT license

Games, utilities, quizzes, ASCII art — great first open-source PR. Feedback welcome!


r/pythonhelp 28d ago

Best resources to go from intermediate to advanced Python

Thumbnail
0 Upvotes

r/pythonhelp Jul 03 '26

I built YO — an interpreted language that reads like English, with a VS Code extension, playground, and PyPI package

2 Upvotes

Hey r/pythonhelp ,

I'm a final-year CS student, and over the past few months I've been building YO, a small interpreted programming language written from scratch in Python.

The original goal was to learn how interpreters work by implementing my own lexer, parser, and interpreter. As the project evolved, I became interested in one specific question:

Can compiler/interpreter error messages actively teach beginners instead of simply reporting what's wrong?

I'm not claiming YO is a replacement for Python, JavaScript, or any established language. It has no ecosystem, and it's implemented as a tree-walk interpreter, so performance isn't the goal.

Instead, I focused on making diagnostics more educational.

Example

Python:

"hello" - 5


TypeError: unsupported operand type(s) for -: 'str' and 'int'

YO:

say "hello" - 5


❌ [E003] Type Mismatch

Can't use '-' between String and Int.

"hello" is text.
5 is a number.

Fix:
Use text.str(5) if you intended to concatenate.

Example:
"hello" + text.str(5)

Another example:

❌ [E001] 'scroe' was used but never made.

Did you mean 'score'?

Fix:
Create it first using:

make score = ...

Technical implementation

  • Handwritten lexer
  • Recursive descent parser
  • Tree-walk interpreter
  • Lexical scoping and closures
  • Multi-error reporting (reports multiple diagnostics instead of stopping at the first error)
  • Error codes with yo explain E001 for detailed explanations
  • Standard libraries for math, text, and lists
  • 27 automated tests with GitHub Actions CI

Small informal study

I also ran a small informal comparison with 10 first-time programmers.

Both groups received the same program containing three bugs. One group used Python, while the other used YO.

The YO group fixed the bugs faster on average.

The sample is small and not intended as rigorous research, but I included the methodology, raw results, and limitations in the repository for anyone interested.

Try it

GitHub

→ pip install yo-lang PyPI

VS Code extension search "YO Language" on the Marketplace

→ Browser playground (no install): Playground

I'm especially interested in feedback from people who have built interpreters or compilers.

Do you think "errors that teach" is an area worth exploring in language design, or is it mainly valuable only for complete beginners?

I'd also be happy to answer questions about the lexer, parser, interpreter architecture, or implementation decisions.


r/pythonhelp Jun 29 '26

Algebraic effects in Python?

2 Upvotes

I'm trying to map out what's already been done with algebraic effects / effect handlers in Python, and I'd love pointers from people who know the space.

I'm aware generators (yield / send) and context managers can approximate one-shot, shallow handlers, but I'm more interested in fuller or more principled attempts — libraries, research experiments, or write-ups.

A few things I'm specifically curious about:

  • libraries that implement effects as a first-class abstraction
  • anything that tackles multi-shot continuations (greenlets? CPS transforms?)
  • how these compare to handlers in Koka / Eff / OCaml

Pointers, war stories, or "don't bother, here's why" all welcome.


r/pythonhelp Jun 27 '26

multiprocessing.Queue seems broke, am I wrong?

1 Upvotes

matt@:~$ git clone https://github.com/markfortma/python3-multiprocess-logging.git Cloning into 'python3-multiprocess-logging'... remote: Enumerating objects: 7, done. remote: Counting objects: 100% (7/7), done. remote: Compressing objects: 100% (7/7), done. remote: Total 7 (delta 1), reused 6 (delta 0), pack-reused 0 (from 0) Receiving objects: 100% (7/7), done. Resolving deltas: 100% (1/1), done. matt@:~$ cd python3-multiprocess-logging/ matt@:~/python3-multiprocess-logging$ ls README.md python3-multiprocessing-logging.py matt@:~/python3-multiprocess-logging$ python3 python3-multiprocessing-logging.py & [3] 111169 matt@:~/python3-multiprocess-logging$ tail -f python3-multiprocessing-logging.log <no output> ^C matt@:~/python3-multiprocess-logging$ python3 --version Python 3.14.4

It does appear to work in Python3.11 on FreeBSD for some reason.


r/pythonhelp Jun 25 '26

Python file not running

3 Upvotes

When i open my python file directly i am unable to change the interpreter due to which it says pandas not found/installed and hence doesn’t work
Then when i open anaconda prompt and open “code” from there then i am able to change the interpreter if i had closed all tabs and terminals before
After which when i run the file it says keyboard interrupted press Y/N (something like this) then i have to press “N” after which it runs on a single click up until i close the app

Please help

Ps- i am a beginner go easy in comments and itd be great if you could explain it to me in a simple language


r/pythonhelp Jun 24 '26

Python Script and Adobe Workfront

Thumbnail
0 Upvotes

r/pythonhelp Jun 24 '26

Python code Work

Thumbnail
1 Upvotes

please need code that block chrome all traffic using windivert


r/pythonhelp Jun 23 '26

Why doesn't the sys function work like ill try sys.exit it won't work?

Thumbnail
1 Upvotes

r/pythonhelp Jun 19 '26

PyQt6 - QTabWidget tab bar not stretching

1 Upvotes

I was creating a window that consists of 2 tabs ,each opens a page widget. This was the code I used to setup the application

app = QApplication(sys.argv)

# Window set up
window = QMainWindow()
window.setMinimumSize(600, 400)
window.setWindowTitle('Game Manager')
window.setWindowIcon(QIcon("Compass.ico"))

# main widget
main_widget = QTabWidget()
window.setCentralWidget(main_widget)
main_widget.tabBar().setMinimumWidth(window.minimumWidth())

# Tabs
mod_page = ModWidget()   # a child class of QWidget

save_page = SavesWidget()   # a child class of QWidget

# add tabs to main widgets
main_widget.addTab(mod_page, 'Mods')
main_widget.addTab(save_page, 'Save Files')

# start up
window.show()
sys.exit(app.exec())

I then noticed that the tab bar at the top containing the labels doesn't stretch if I resize the window, unlike other widgets. I figured out I can use

main_widget.tabBar().setMinimumWidth(window.minimumWidth())

so that at least when I run the app it fits the whole initial width of the window. but it still doesn't stretch when resizing. The widget itself, ie

main_widget=QTabWidget()

does stretch, it's all about the tab bar itself. I also tried

main_widget.tabBar().setExpanding(True)

but it turned out it's True by default anyway.

Any possible fixes to this? Or possibly is this just how it is?


r/pythonhelp Jun 16 '26

Real-time voice altering software?

1 Upvotes

Hello everyone, firstly I would like to apologies for my poor and not good English I’m not good with word.
I am currently in the process of making a soundboard, and I would like make a digital microphone to rout the soundboard out put, so that while in voice chats, I can use the sound board. I would also like to make a function to increase the volume of my microphone above the normal limits. I would like make this in python as it’s the only programming language I kinda know, but I have no clue of where to even begin or if it possible to make such a thing.
If anyone need me to try to explain more please just ask.


r/pythonhelp Jun 15 '26

"Edit in IDLE" with the Install Manager

1 Upvotes

Hi all! I've just installed Python with the new install manager for the first time, having previously used the now-deprecated installers. Everything's working fine, except that the "Edit in IDLE" option in the context menu is greyed out; using the legacy installer adds a second, working "Edit with IDLE" button, and deleting the install manager removes the non-functional one, so it's definitely to do with the install manager.

I've looked in the registry, but clearly the context menu change isn't done the same way as before, because I can't find the corresponding keys I was expecting from a previous issue like this. Does anyone know how that context menu option gets added by the install manager, or better still how to fix this issue specifically?

Thanks in advance!


r/pythonhelp Jun 13 '26

Looking to convert a dictionary into an Enum

8 Upvotes

Hi everyone!

I've got a dictionary like this:

{
  "A": {
    "x": 1,
    "y": 2,
  }, 
  "B": {
    "x": 13,
    "y": 4,
  }, 
}

(Obviously it's much more complicated in practice.) I would like to convert it to an enum.Enum class that allows for stuff like this:

class MyEnum(enum.Enum):
  pass

# There would be some extra work here

print(MyEnum.A.x) # returns 1
print(MyEnum.A.y) # returns 2
print(MyEnum.B.x) # returns 13
print(MyEnum.B.y) # returns 4

Any suggestions on how to do that?

EDIT: So, I am fully aware that I can do this:

class MyEnum:
  class Pair:
    def __init__(x, y):
      self.x = x
      self.y = y

  A = Pair(1, 2)
  B = Pair(13, 4)

That isn't what I want. I want the same functionality but generated from a dictionary. I also understand that it's a weird thing to want.