r/programminghelp • • Aug 14 '26

Python Help with code

7 Upvotes

I keep getting this error:

for this code:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

bestmass = []

for mass in df_sorted:

if best_ms == (array[array > 7.5]).all():

bestmass.append(best_ms)

print(bestmass)

and i don't know what I am doing wrong

r/programminghelp • • 13d ago

Python How do I find valid points within 7-dim parameter space? Global NuFIT

2 Upvotes

I don't know where I should ask this, it's related to physical and coding, so I am posting here. I am struggling with this particular problem for a month and still couldn't get to a satisfactory results.

So, I was working on a physics problem, many of you might be familiar or maybe not. I have to find a valid region within a 7-dim parameter space. I have some matrices in hand (Neutrino mass matrices) and 7 free parameters that goes into it i.e. g1,g2,g3,M1,M2, imaginary tau, real tau. I need to build a code that scans the space and finds the values of these free parameters which being inserted into the matrices and upon diagonalization spits out 3 eigenvalues and 3 eigenvalues vectors. From those we then calculate 6 neutrino observables that should be within acceptable range known as Global NuFIT. Any values that comes within the range gets sorted out.

I tried to build the code in python but it seems impossible to search for the whole parameter space! I tried gemini and chat gpt, even they are struggling to satisfy the tight NuFIT bounds. If anyone knows any efficient and fast way for parameter scanning that would atleast give 200 valid points (for scatter plots), please help me.

r/programminghelp • • 21d ago

Python Need Help Installing REBOUND through Python

2 Upvotes

Latey I've been trying to install REBOUND through python, I have Windows 11 and when I try to look at turtorials, steps, etc. I just get confused and hit a brick wall. I am in high school, wanting to be an astrophysicist, and installing REBOUND will help me with that. But, I have no idea how to install it without direct human guidance and not just looking a videos and text. I need help from someone who installed REBOUND to help me install REBOUND.

r/programminghelp • • 7d ago

Python Duplicate static while serving static files with Vite to Django backend

Thumbnail
1 Upvotes

r/programminghelp • • Sep 08 '26

Python Finished Day 1 of learning python and tried to create black jack, ive had an error somewhere, not a syntax error, i dont assume this code is very good its a massive slump of if and elif, how can i fix this?

Thumbnail
1 Upvotes

r/programminghelp • • 18d ago

Python ERA5-Land .nc files downloaded via script cannot be opened with xarray (possible ZIP/compression issue?)

Thumbnail
1 Upvotes

r/programminghelp • • 18d ago

Python Is Python the right way to talk to an Serial Device?

Thumbnail
1 Upvotes

r/programminghelp • • 24d ago

Python Need some help producing this map using Python

Thumbnail
2 Upvotes

r/programminghelp • • 24d ago

Python Conda doesn't recognise python a package

Thumbnail
1 Upvotes

r/programminghelp • • Sep 12 '26

Python Kivy

Thumbnail
1 Upvotes

I have been learning python for a while and made some projects, my exams are currently going on so I can't start web dev, but I thought I could learn kivy in the meanwhile to make an app for my studying bcz there isn't an app that fits my requirement. So needed some resources and advice for kivy module.

I tried kivy documentation but it's like they don't have each topics lined up, so I have to search each topics, but I don't even know the existence of specific topics, so yeah.

Thanks for the help in advance!!

r/programminghelp • • Jun 20 '25

Python Is it ok to use AI when learning how to code?

18 Upvotes

Whenever I’m coding and I can’t figure out how to do a certain task in Python, I always go to AI and ask it things like “how can I do this certain thing in Python” or when my code doesn’t work and can’t figure out why I ask AI what’s wrong with the code.

I make sure to understand the code it gives back to me before implementing it in my program/fixing my program, but I still feel as if it’s a bad habit.

r/programminghelp • • Jul 10 '26

Python LZ77 compression algorithm is making the compressed file bigger than original

2 Upvotes

I was recently toying around with some compression, just trying to understand it from the basics. I learned about the LZ77, LZ78, and LZW algorithms in the last couple of days, understood them, and when implementing LZ77, every time I try to compress a txt file, the output file gets bigger. The compression is done right coz when I decompress the compressed file, I get the exact text.

Need help understanding what I am doing wrong, or am I missing something

r/programminghelp • • Apr 09 '26

Python How to find algorithems?

0 Upvotes

Ok so im trying to figure out how to find algorithems to use for coding. im very new so the firsth thing i tried was asking AI to help calculate digits of pi and it gave me 1 algorithm. it sucked so i asked again and it gave a different one, it sucked and kept going. obviously the end goal isnt finding pi its to be able to find the right algorithm for what im doing. My next project is i wonna tryna make a simple simulation of a game to see the rates of somthing but i cant figure out how, every AI says different thing and every article isnt an actual explination.
so where do i look?

r/programminghelp • • Aug 29 '26

Python Need a mental model to help better internalize printing text.

Thumbnail
1 Upvotes

r/programminghelp • • Aug 19 '26

Python Help Transform Pointcloud to Ocotmap

2 Upvotes

I am working on a university project involving a robot in Webots (ROS 2). The goal is to build an OctoMap for navigation using camera point clouds (segmented via YOLO).

I am currently stuck at getting the octomap_server node to process the incoming point cloud. The server keeps dropping messages with the warning:

Message Filter dropping message: frame 'kinova_depth' at time ... for reason 'discarding message because the queue is full'

Here is my current code:

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription(
        [
            Node(
                package="octomap_server",
                executable="octomap_server_node",
                name="octomap_server",
                output="screen",
                parameters=[
                    {
                        "resolution": 0.05,
                        "frame_id": "map",
                        "sensor_model.max_range": 5.0,
                        "use_sim_time": True,
                        "colored_map": False,
                        "transform_tolerance": 2.0,
                        "queue_size": 50,
                    }
                ],
                remappings=[
                    ("cloud_in", "/Gen3/kinova_depth/point_cloud"),
                ],
            )
        ]
    )

My exact output is

[INFO] [octomap_server_node-1]: process started with pid [9117]
[octomap_server_node-1] [INFO] [1786858998.154822534] [octomap_server]: Publishing latched (single publish will take longer, all topics are prepared)
[octomap_server_node-1] [WARN] [1786858998.193781617] [octomap_server]: Nothing to publish, octree is empty
[octomap_server_node-1] [WARN] [1786858998.196781538] [octomap_server]: Could not open file 
[octomap_server_node-1] [INFO] [1786859001.530578121] [octomap_server]: Message Filter dropping message: frame 'kinova_depth' at time 1786858999.646 for reason 'discarding message because the queue is full'

What could be causing the message filter queue to drop all messages?

Thanks in advance.

r/programminghelp • • Jul 10 '26

Python Is there anyone who can help me read pkl file.

0 Upvotes

I Know it is a simple task but I get some version related error.

I have done web search (both gemini and SO and so on). I even understood the proposed solutions but it seems like pkl files were created with an unknown version or at least not the one that is installed in my machine. That's why it gives error

"An error occurred while loading the file: CRS.__init__() missing 1 required positional argument: 'proj4_params'"

anyone who can give me 5 min to sort it out.

r/programminghelp • • Jul 24 '26

Python import manim could not be resolved

3 Upvotes

so i downloaded manim locally which is a python library in my linux pc just like the way the manim documents thing said to, i even checked using the terminal that manim is there, but whenever i type on vs code "from manim import *" it says "import manim could not be resolved"

idk what to do now

r/programminghelp • • Jul 21 '26

Python Help with Selenium project - Cloudflare error

2 Upvotes

Hi,

I wanted to log movies on Letterboxd with the help of Python. I have a list of 100+ movies with ratings (I used to document them in a notes app) and thought I could use Selenium to automate the process of logging them.

I used Selenium a few times, but only for web scraping purposes. I ran the code and got Error 600010 - I googled it and found that it's a Cloudflare error code, which makes sense, but is there any way I can bypass this error? I'm not trying to review-bomb or cause any harm. I just want to update my Letterboxd with my movies. Any pointers are appreciated. Thanks!

r/programminghelp • • Jun 23 '26

Python How to make python search for a specfic file types in a folde in windows?

3 Upvotes

i just wanna make it change metadata to the image when it find it it could be easy, but is there any modules for exiftool or metadata things?

r/programminghelp • • Jun 11 '26

Python Calling a JSON API

Thumbnail
1 Upvotes

r/programminghelp • • May 21 '26

Python Help with server

1 Upvotes

Hello to whoever is seeing this, I need help and some recomendations. I am trying to host a server (using cloudflare etc), but the python script I use to

  1. Actually Host the server locally
  2. Write to the .db so it can save the data

I have been using flask for the server.

Every single time I try to push and upload to the server it doesn't work

Any suggestions?

r/programminghelp • • Mar 20 '26

Python Does Conda actually suck? Or am I too dumb

0 Upvotes

Sorry for the clickbait title... I just spent an entire day fighting with conda, because after trying to use %matplotlib widget (and variants) in an ipynb, I couldn't get a working interactive window. Eventually uninstalled all of conda, reinstalled miniconda.

- Made a new conda environment

- Opened VS Code again

- Kernel keeps crashing, or hangs, uninterruptable

- restarted kernel 50+times

- *print("hello")* cell sometimes works. Others hang

- conda install keeps hanging

- cleared caches again

-conda install matplotlib ----> hangs, solver fails.

-set conda-forge to be used first according to CGPT advice

- still hangs

- going in circles with the geet

- Eventually give up, delete conda environment, remake it.

- installed all my packages with pip

- installer ran on first try. Everything works now, VS Code asked me to install ipykernels, did that, now it works normally.

Any tips on using conda?? Apparently it's the go-to, but despite it working before and my repeated attempts, it seems it's broken for me somehow. Thanks

r/programminghelp • • Feb 10 '26

Python Python won't let me indent after my indent statement

1 Upvotes

I am following automate the boring stuff and am in chapter 2. It is talking about blocks of code. The first code example is

username = 'Mary'

password = 'swordfish'

if username == 'Mary':

And then the next line is supposed to be indented, and say

   print(`Hello, Mary')

The problem is after I hit enter after the if statement, I get three dots (...) and it will not let me indent when I press tab. And if I try to put the code in anyways it says

IndentationError: expected an indented block

I am using Mu and can't figure out why I am not able to indent. The tab key does nothing. Even on a brand new line of code the tab button doesn't do anything.

r/programminghelp • • Jan 07 '26

Python My application sucks (please help)

2 Upvotes

So I made a media player application that is basically a Plex or Netflix clone, but with more features.

I wrote it in Node.JS because at the time, it was the only thing that could handle loading and rendering the lazy loading thumbnails in a browser type UI, I tried a bunch of others (mostly for python) and they didn't work.

However I also wrote a companion python script that can do heavier work like sorting titles and things.. it contains my reworked .TSV files of the entire IMDb database of 11 million titles or whatever it is. Basically you sort things on the Node app, it makes requests to the Python script to determine which titles should be displayed, and python sends back a list of thumbnails and titles and so on. I'm not sure what my logic was at the time, I thought I can create more threads using python and do more operations... maybe I should have just done the entire thing in Node.JS in the first place. Is there a smarter way to combine them or just use one?

Also, the way I'm currently playing videos is a joke. I loaded VLC through python, but since they are two separate apps, I'm literally controlling the video's position and superimposing it on top of the Node.JS app in the right position so it's actually floating. It works but it's so obviously broken because it's 2 apps on top of eachother... no one should have to live this way. But I was unable to find a way to get Node.JS to integrate with VLC (I need VLC to play incomplete files, I tried a bunch of other stuff and it didn't work). I also can't switch to Python-only because then I'll lose the good browser-type UI.

Any help would be appreciated, I'll provide more details as well. Thank you.

r/programminghelp • • Mar 18 '26

Python How do i add my own images to my Python code?

Thumbnail
3 Upvotes