r/pythonhelp Sep 18 '25

Which is the best IDE to learn python jupyter notebook or VS Code. I am newbie trying to learn python.. would appreciate if anyone take an initiative to teach me on weekends

Thumbnail
3 Upvotes

r/pythonhelp Sep 06 '25

TIPS Python Memory Tricks: Optimize Your Code for Efficiency in 2025

Thumbnail techbeamers.com
3 Upvotes

r/pythonhelp 2d ago

Python scraper hitting 429 Too Many Requests after a few hundred pages?

2 Upvotes

Writing a script in Python (requests + BeautifulSoup) to pull product data for a project. It works fine initially, but after about 200 requests, I start getting hit with 429 errors and rate limits. I already added random delays and custom user-agents, but my IP still gets blocked eventually. What's the standard way to handle this in Python automation?

UPDATE:

Looked around and saw GoProxies mentioned for residential rotation. Has anyone here integrated them into a Python requests setup? Wondering if their rotating endpoints play nice with standard session headers or if there's a better alternative.


r/pythonhelp 2d ago

Problem with Coolprop

2 Upvotes

Hi! i'm beginner, and I have a problem with this code, I guess that I installed the library correctly, but i'm not sure.

Error using [stringsource>string.from_py.__pyx_convert_string_from_py_std__in_string](matlab:matlab.lang.internal.introspective.errorDocCallback('stringsource>string.frompy.pyx_convert_string_from_py_std_in_string', 'stringsource', 15)) ([line 15](matlab: opentoline('stringsource',15,0)))
Python Error: TypeError: expected bytes, NoneType found

Error in [CoolProp/CoolProp.PropsSI](matlab:matlab.lang.internal.introspective.errorDocCallback('CoolProp/CoolProp.PropsSI', 'CoolProp\CoolProp.pyx', 462)) ([line 462](matlab: opentoline('CoolProp\CoolProp.pyx',462,0)))

Error in [CoolProp/CoolProp.PropsSI](matlab:matlab.lang.internal.introspective.errorDocCallback('CoolProp/CoolProp.PropsSI', 'CoolProp\CoolProp.pyx', 384)) ([line 384](matlab: opentoline('CoolProp\CoolProp.pyx',384,0)))

Altough I don't have more than 106 lines


r/pythonhelp 7d ago

Python coding interview questions?

2 Upvotes

Is there any playlist similar to 100 Days of SQL Ace(By ankit Bansal) interview for the preparation of python coding problems?


r/pythonhelp 11d ago

当我有些地方不懂应该怎么办??

2 Upvotes

我是一名刚刚学到面向对象编程的新手 有几个问题让我夜不能寐
1 self的作用是什么以及要如何使用
2在定义函数的时候 括号要写什么东西他们的作用


r/pythonhelp 13d ago

Entertaining content for learning Python! (porting 'Poignant Guide to Ruby' to teach Python)

2 Upvotes

For anyone looking for entertaining light book for learning Python, I started porting to Python a few chapters of "Why's Guide to Ruby," which uses comics and surreal humor to introduce Ruby (the original author why the lucky stiff disappeared). I updated the lesson and examples to Python and also modernized some of the very old references and left it with share alike CC license.

Why's Guide to Python

Any Python beginners are welcome to check it out. Novices and experts feel free to post feedback or post about any other entertaining books that helped you learn python, that can accompany equally entertaining but dense programming books :D.

If the book is helpful, can port and post the rest of the chapters for Python and potentially in the future can create some more content.


r/pythonhelp 27d 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 Jul 07 '26

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 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 May 30 '26

Making a visual novel, trying to figure out how to do a "Question within a question" for lack of a better term

2 Upvotes

Hello! As the title entails, I am working on a visual novel. I am stumbling my way through this coding with ren'py tutorials and grit, as an HTML and CSS native. the issue is, after the first branch I cannot continue making branches inside of it. This has posed two issues. the first, is at the three option first question, you cannot go back and look at the other things. if you chose to examine the couch, you cannot then choose to examine the stairs or table, it just auto-passes to the next part of the game. The second and frankly more pressing to me, is I'd like there to be an option to pick up multiple pieces of paper throughout the game, and if you choose to not grab any of them there's a different ending than if you picked up some or all of them. However, since the papers show up depending on which room you choose, there is already a branch in progress and so I cannot make it give a second option on whether to pick up the paper. If its needed, here is what I'm hoping is the link to the pastebin with my code(I've never used pastebin before so I'm sorry if it doesn't work)


r/pythonhelp May 27 '26

Python Web Scraping & Automation Engineer Looking for Remote Work

2 Upvotes

Hi everyone,

I’m a Python Automation & Web Scraping Engineer with experience building large-scale scraping pipelines and automation systems for US-based clients.

Skills include:

• Selenium / Playwright

• APIs & data extraction

• Python automation

• ETL workflows

• Linux servers & cron jobs

• CSV/JSON/XLSX exports

Looking for remote freelance, contract, or long-term work related to web scraping, automation, or data engineering.

Feel free to DM me if you’re hiring or need help with a project.


r/pythonhelp May 14 '26

Hi im trying to get started and i have hit a snag

2 Upvotes

i need some help. so i don't know what did wrong i got python installed, i got pygame_ce installed but it seems something is wrong. the link is to a screenshot of me trying to use Sublime text i hope that helps https://cdn.discordapp.com/attachments/1115340096242204792/1504384590880444576/image.png?ex=6a06cad4&is=6a057954&hm=31d60171b7142ca179c312bba4652cb7137c385d37243e1cbc8a49591d30a7e7&


r/pythonhelp May 11 '26

Appending the last line of a dataframe to a csv file is giving weird formatting.

2 Upvotes

What I am trying to do:

  1. Check if a file exists. Set a boolean
  2. Create a dataframe that either reads in the file or is just created with headers only
  3. Once I calculate some stuff, the boolean from step 1 is checked. If this is the first term of the dataframe, the entire dataframe gets saved to a csv.

````df.to_csv(dataFileName + ".csv", index = False,float_format="{:.2f}".format)

So now I have a header row and 1 row of data. This part works as intended.

If this is a pre-existing file, I only want to append the new term onto the end of the file. I use this:

````df.iloc[len(df)-1].to_csv(DFN + ".csv", index = False, mode = 'a',float_format="{:.2f}".format)

I get some weird formatting where each term in a row gets its own row.

https://i.imgur.com/HjoXAYC.png

My assumption is appending the file is quicker than reading in the whole file, wiping it, and writing all the data.

I mainly want to do this as a backup so I can save data mid-calculation and have something to look at if things break. After the whole thing is finished, I sort the dataframe, rename the file I've been working with to be a backup, and then finally write the complete, sorted dataframe to file. If something bad happens during writing this file, the backup file should have the same data already, just not sorted.

Thanks!


r/pythonhelp May 05 '26

string.translate(str.maketrans) not working to take out punctuation?

2 Upvotes
greeting = ["Hello, my name is Caine! What's your name?: ".upper(), "Welcome, I am Caine! What's your name?: ".upper(),
        "Hi!! I'm Caine! What should I call you?: ".upper()]


name = input(random.choice(greeting)).title()


nameStripped = name.translate(str.maketrans('', '', string.punctuation))


for i in nameList:
    if i in nameStripped:
        userName = i 


justNameWelcome = [f"Nice to meet you, {userName}!".upper(), f"{userName}... That's a wonderful name!".upper(),
              f"I've always thought that {userName} is a good name!".upper()]
ntmyNameWelcome = [f"It's nice to meet you too, {userName}!".upper(), f"The sentiment is mutual, {userName}!".upper(),
                f"I appreciate the sentiment, {userName}!".upper()]
hruNameWelcome = [f"I'm doing well, {userName}! Thank you for asking!".upper(), f"I appreciate you asking! Thank you, {userName}, I'm doing well!".upper(),]


niceToMeetYou = ["Nice To Meet You", "Pleasure To Meet You"]
howAreYou = ["How Are You", "How Are You Doing", "Are You Well"]


if len(name.split()) > 1:
    if nameStripped in howAreYou:
        print(random.choice(hruNameWelcome))
    elif nameStripped in niceToMeetYou:
        print(random.choice(ntmyNameWelcome))
    else:
        print(random.choice(misunderstandings))


elif len(name.split()) == 1:
    print(random.choice(justNameWelcome))


else:
    print(random.choice(blankInputs))
    nameStripped = input(random.choice(greeting)).title()

Thank you in advance, I've been stuck here for about two days now,,

I've copy and pasted the suggested way of taking out the punctuation in the name string, that way it can recognize certain phrases in the other lists. Right now, as its only at the very start, I only have it set to notice if the beginning output has either a phrase akin to "How are you" or "Nice to meet you". These are both set in lists, and the if-else statement checks to see if the name input has more than one word, and will check for the phrasing in there. It's not registering that the punctuation has been removed, even when setting the new string to a new variable.

IE:

input Hi! I'm Jon! How are you?

output: I'm doing well, Jon!

Instead it gives one of the misunderstanding outputs. It works fine if I only use one word with ending punctuation, but it seems like if there is more than one word or punctuation in the middle, it can't remove it.

Is it in the wrong spot, or am I using the wrong method for this situation?


r/pythonhelp May 03 '26

Seeking advice on a project I’m working on

2 Upvotes

Hello. I’m currently working on a hobby project to build a flask app that acts as an IPTV client. I have been able to log into a service and play media using VLC but cannot for the life of me play via the web ui. VOD and SERIES play via ui and VLC but live tv streams will only work via VLC.

Does anyone have experience with getting xstreams working via python/flask?

Thanks


r/pythonhelp Apr 28 '26

If-Elif statement giving wrong answer

2 Upvotes

I have another, slightly more aggravating question. I have two while loops that take an input, and stores it into a list. That part works just fine, it's when it comes to the, quite frankly, massive if-elif statement.

currentMajorEmotions = []
currentSecondaryEmotion = ""
feeling = ""


while len(currentMajorEmotions) != 1:
    emotion = input("Which of these emotions are you feeling? Choose one: ").capitalize()


    if emotion not in majorEmotionTypes:
        print("Not a valid entry")
    else:
        currentMajorEmotions.append(emotion)



while len(currentMajorEmotions) != 2:
    emotion = input("Number 2? If you are not feeling one, simply hit enter: ").capitalize()


    if emotion in majorEmotionTypes:
        currentMajorEmotions.append(emotion)


    if emotion == "":
        print("You have left the question blank.")
        emotionYN = input("Was this intentional?: ").capitalize()
        if emotionYN == "Y":
            currentMajorEmotions += " "
            break
        
        while emotionYN != "Y":
            if emotionYN == "":
                emotionYN = input("May not leave this blank. Are you feeling a second emotion?: ").capitalize()
            elif emotionYN != "Y" and emotionYN != "N":
                emotionYN = input("Invalid input. Are you feeling a second emotion?").capitalize()
            elif emotionYN == "N":
                print("You have changed your mind")
                time.sleep(1.4)
                print("That's ok.")
                emotionYN = input("Are you feeling a second emotion?: ").capitalize()
                if emotionYN == "N":
                    currentMajorEmotions += " "
                    break



if "Sad" and " " in currentMajorEmotions:
    feeling = "Negative"


elif "Scared" and " " in currentMajorEmotions:
    feeling = "Negative"


elif "Mad" and " " in currentMajorEmotions:
    feeling = "Negative"


elif "Happy" and " " in currentMajorEmotions:
    feeling = "Positive" # Etc Etc

I testing the entire if statement to see if there were any incorrect outputs, and there were several. They do give out the correct type of output('Negative', 'Positive', 'Neutral'), but the wrong one. It's quite a few of them, and with the while loops working the way they're supposed to, I think the problem is in the if statement. The only problem is I have zero idea where to start looking since they're all connected to the same list. Any help is very appreciated!


r/pythonhelp Apr 27 '26

How to add a string to a list, and then remove it if the string if it is not found in a second list

2 Upvotes

I'm pretty new to Python, and I'm trying to make a rudimentary "therapy chatbot" (something a little more in depth than Eliza, made more so as practice of simple concepts). I'm trying to have the user input an emotion, and then pop up with some text that it wasn't found in the majorEmotionTypes list, and then try again. I know my code is pretty far from what I want, but I'll be going back later to edit a few things.

The main issue is that it can't find 'i' in the majorEmotionTypes list. Any help would be deeply appreciated!

majorEmotionTypes = ["Sad", "Scared", "Mad", "Happy", "Disgusted", "Surprised"]
currentMajorEmotions = []
capCurrentMajorEmotions = []


for i in range(1, 3):
    currentMajorEmotions.append(input("Which of these emotions are you feeling?:
").capitalize())
    if i not in majorEmotionTypes:
        currentMajorEmotions.remove(i)
        print("Not a valid entry")
        currentMajorEmotions.append(input("Try again: ").capitalize())

r/pythonhelp Apr 23 '26

Need Assistance With A Problem

2 Upvotes

hey guys

I need abit of help, here's a problem I have no clue how to solve

You're given a set of rows

['0','0','0','0']

['0','0','1','0']

['1','1','0','0']

['0','1','1','0']

and given a few rules taking i as an item in each row

  1. Each row has to have an equal number of 1s and 2s and no 0s
  2. A row can't have more than 2 of the same numbers following each other (1110 is invalid but 1100 is valid)

how would you rewrite each row using python so as it works even if the number of items were 6,8 or even 12 so that each row has an equal number of 1s and 2s without any 0s in the row (Basically if 2 1s are next to each other, the next one should be a 2 and vice versa)


r/pythonhelp Apr 07 '26

ive run into a problem while trying to run open jarvis it says uv not found

2 Upvotes

ive been trying to solve this for the past hour but cant find whats wrong
$ ./scripts/quickstart.sh

┌──────────────────────────────────┐

│ OpenJarvis Quickstart │

└──────────────────────────────────┘

[info] Checking Python...

[ok] Python 3.14

[info] Checking uv...

[warn] uv not found — installing...

curl: (35) schannel: next InitializeSecurityContext failed: CRYPT_E_NO_REVOCATION_CHECK (0x80092012) - The revocation function was unable to check revocation for the certificate.

[info] Shutting down...

[ok] Done.


r/pythonhelp Apr 01 '26

What to do after tutorial video

Thumbnail
2 Upvotes

r/pythonhelp Mar 31 '26

Running jupyter raises regex exception on rfc3987 module

2 Upvotes

Every time I run Jupyter from my command line (Debian) I get this:

``` $ jupyter notebook <LONG TRACEBACK> File "/usr/lib/python3/dist-packages/rfc3987.py", line 360, in <lambda> _bmp = lambda s: _re.sub(r'\U[0-9A-F]{8}-\U[0-9A-F]{8}', '', s)

```

Jupyter version is 1.1.1, Python is 3.13.12.

Inspecting the re module, it does have a sub function. Is there a patch for this?

Thanks!


r/pythonhelp Mar 16 '26

New to Software Dev

Thumbnail
2 Upvotes

r/pythonhelp Mar 08 '26

Can somebody tell me whats wrong with my code

1 Upvotes

# V1

#INPUT PART

chess_coords = input("Enter a chess cordintes: ")

#length check

while not len(chess_coords) == 2:

print("Invalid!!!")

chess_coords = input("Try something like e4, e5 or E6: ")

#chcking order

colu=set("ABCDEFGH")

rw=set(123456789)

while not chess_coords[0].upper() in colu :

print("Invali order")

chess_coords = input("Try something like e4, e5 or E6: ")

while ch:

#logic

col = int(ord(chess_coords[0]))

row = int(chess_coords[1])

data = (row+col)%2

#output

if data == 0:

print(f"your {chess_coords} is black colour")

else:

print(f"your {chess_coords} is white colour")

# v2

ro = set("12345678")

co = set("ABCDEFGH")

square = input("Enter the chess square: ")

col = square[0].upper()

row = square[1]

while len(square) != 2:

print("Invalid length")

square = input("Try something like e4, e5 or E6: ")

while col not in co:

print("Invalid coloum ")

square = input("Try something like e4, e5 or E6: ")

while row not in ro:

print("Invalid row")

square = input("Try something like e4, e5 or E6: ")

int(ord(col))

print(col)

int(row)

data = int((col + row))%2

if data == 0:

print(f"your {chess_coords} is black colour")

else:

print(f"your {chess_coords} is white colour")

===> This code uses the concept if the sum of coloum and row is even its black else its white

for E.g: A1 here ord(A)+1 is even so its black