Questions tagged [python]

Python is a dynamically typed, multi-purpose programming language. It is designed to be quick to learn, understand, and use, and enforces a clean and uniform syntax. Please note that Python 2 is officially out of support as of 2020-01-01. For version-specific Python questions, add the [python-2.7] or [python-3.x] tag. When using a Python variant (e.g. Jython, PyPy) or library (e.g. Pandas, NumPy), please include it in the tags.

python
Filter by
Sorted by
Tagged with
0 votes
0 answers
5 views

Hosting a Django application on azure app service

After following the official host python with postgres tutorial, and making modifications in my gh actions file because my django apps isn't present in the root on the repo, I get a 404 error when ...
ayitinya's user avatar
  • 306
0 votes
0 answers
7 views

scrape ESPN fantasy baseball league player watch list

I am trying to scrape the players on my watchlist, but because the league is private, I am unable to scrape normally as i have to authenticate first. I tried multiple methods such as passing my ...
buttermilk's user avatar
0 votes
0 answers
8 views

Is there a way to read a SQL worksheet on Snowpark?

I have a stored procedure that I want to run using a Python script on Snowpark. But I want to read the SQL from another worksheet. Is there a way to read such files on Snowpark Workaround for this is ...
Sudharsan Janardhanan's user avatar
0 votes
0 answers
5 views

Solving Valueerror of Tooth segmentation model in machine learning for my graduation project please

here's the GitHub link for tooth segmentation model : HTTPs://github.com/Arnold0210/TEETH-RECOGNITION-WITH-MACHINE-LEARNING Hi everyone, I'm having some issues with the code in classification.py from ...
aya mohamed's user avatar
1 vote
1 answer
15 views

Why is JAX so slow?

I started playing with JAX recently, as swap for numpy, and I was not giving much thought into testing if it is really better than numpy, till I have started exploring vectorization, and found this ...
W4ltz's user avatar
  • 31
0 votes
1 answer
8 views

How to avoid "ImportError: attempted relative import with no known parent package" error

Background: I have a bunch of small-to-medium python programs that I'm trying to simplify by factoring out common code into a module that all the programs import. The problem I run into is that when ...
Chris Dodd's user avatar
  • 123k
-1 votes
1 answer
15 views

Attempting to some sort of alarm for when a person is identified

Using a TensorFlow model I wanted to add some sort of alarm that would go off for whenever a person was detected as the window was running whether it be a flashing colored border or an audio noise. I'...
Kyle Greenwood's user avatar
-1 votes
0 answers
9 views

Running Multiline py files in Azure Maschine Learning Studio Notebooks

I'd like to know the best practice of running multiline shell commands in a ml notebook Here is some pseudocode and how i would run IT in a notebook cell. %%bash conda activate myenv && ...
RSale's user avatar
  • 471
0 votes
0 answers
9 views

ValueError:Unable to create tensor,Perhaps your features (`text`) have excessive nesting (inputs type `list` where type `int` is expected)

I'm working on fine-tuning mbart-large-50 and i keep getting the same error no matter what i did tokenize method # Pre-trained tokenizer tokenizer = MBart50TokenizerFast.from_pretrained("facebook/...
shahad's user avatar
  • 1
0 votes
1 answer
14 views

"How to Troubleshoot File Saving Issues When Uploading to Server?"

"Hello Community, I'm currently working on a client-server application, and I've encountered an issue when uploading files to the server. It seems that when I upload a file, it's not being saved ...
Jorge Leonardo's user avatar
0 votes
2 answers
24 views

Invalid block tag on line ...: 'endblock', expected 'endwith'. Did you forget to register or load this tag?

I have a problem with my project on Python Here is a code, that located in Django template {% extends "base.html" %} {% load django_bootstrap5 %} {% block content %} <form method="...
Exe_cutor77's user avatar
0 votes
0 answers
11 views

Django DEBUG Logging doesn't print anything?

I'm currently working on implementing logging in my Django project, but I'm encountering an issue where calls to logger.debug('log') do not output anything. I suspect there might be something wrong ...
zdeneklapes's user avatar
0 votes
0 answers
5 views

Intel Realsense & Yolo Instance Segmentation Issues

I am currently working on a system on a raspberry pi that uses a YOLOv5 instance segmentation model to classify different foods and mask them. I then want to use the detected classes to find the ...
Jack H's user avatar
  • 1
0 votes
0 answers
8 views

Why do I encounter no such file or directory in my s3 script

I tried running the script but encountering error import os import boto3 # Create an S3 client s3 = boto3.client('s3') # Set the bucket name bucket_name = 'heavyclick' # Function to upload a ...
Divine's user avatar
  • 1
0 votes
0 answers
8 views

Flask Session Variable Not Keeping Values

I've been building the flask program underneath: app = Flask(__name__) app.secret_key = b'_5#y2L"F4Q8z\n\xec]/' DATABASE = "qa_database.db" def get_db(): db = getattr(g, "...
user24204655's user avatar
-1 votes
0 answers
28 views

Python: exception thrown list index out of range [closed]

I'm following a youtube tutorial online about machine learning and name generation however I'm altering the list of names to Jojo stands: https://www.youtube.com/watch?v=Zy6-ixrY3gs&list=...
Eckvice's user avatar
  • 17
1 vote
2 answers
24 views

Why isn't the tkinter frame being hidden?

When the username is hello and the password is world, why isn't the frame being hidden (forgotten) I've tried to .destroy() which only removes the button Heres my code: import tkinter as tk from ...
Phantom's user avatar
  • 13
0 votes
0 answers
5 views

Making object on canvas take action corresponding to 2d list

I have a matrix consisting of 0 and 1, where 0 is an empty area and 1 is an obstacle. I've made a canvas with colored squares according to each value in the matrix, forming a grid. I also have a ...
not_castillo's user avatar
0 votes
0 answers
6 views

In Django ORM log all quaryes in one transaction

I would like to log all SQL statements in one transaction. I would like to distinguish between def test_function_1(): all = MyObject(id__in=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) for i in all: ...
Marko Zadravec's user avatar
-1 votes
1 answer
14 views

how to get text from an object in seleniumbase?

seleniumbase launches a browser, opens a page, and enters a query into the search box. Then follows the links in a loop. And then in each link at each iteration of the loop, tries to pull h3 out of ...
kuchuluk's user avatar
1 vote
1 answer
23 views

Uninstall last pip installed packages

I have just installed a package in my virtual environment which I shouldn't have installed. It also installed many dependency packages. Is there a way to roll back and uninstall the package and its ...
User981636's user avatar
  • 3,435
0 votes
0 answers
7 views

How do I convert a tflite action recognition model to a coreml model using coremltools convert?

I have a tflite model stored in a variable tflite_model. I used transfer learning to train the action recognition model MoViNet on a custom dataset, and I'd like to use this model in an Xcode project. ...
cassenav's user avatar
  • 133
0 votes
0 answers
6 views

Mark_text Altair doesn't working with multiple data at same month

I'm writing a code in python with altair and streamlit. I wrote all the code and have almost everything working, but im having a issue with multiple data sum() mark_text on same month. Example: DT ...
Renan Ceolim Ramos's user avatar
0 votes
0 answers
14 views

FFmpeg is installed but unable to import in python script

I'm new to both Python and Raspberry Pi development. I'm trying to utilize FFmpeg to play video in a RPi app. My import statement is giving me a module not found error "No module named 'ffmpeg'&...
Bryan M's user avatar
  • 101
0 votes
1 answer
23 views

Avoiding repetitive checking of function output before storing into a dictionary

I've a repeating code block of iterating through inputs, checking some functions to return a list and the populating dictionary if the function did return a list, e.g. def some_func(i): "&...
alvas's user avatar
  • 119k
0 votes
0 answers
6 views

How do I get .nbt file to save properly with a new nbtlib.tag.File object?

I am trying to make and save .nbt (structure block) files in Minecraft, using nbtlib. I first tried to see if I could edit an existing file using it, which worked well, but I'm trying to make a new ...
fullwoodenshovel's user avatar
0 votes
0 answers
25 views

Best Python Optimizer To Solve Problems Based On Data With Bounds And Constraints?

I have a problem that will only get larger and more complex as I build it out. But I am already seeing some issues as of now in that it's having difficulty finding the right answers. The problem ...
we_are_all_in_this_together's user avatar
-6 votes
0 answers
18 views

The file with "Auto py to exe" shows that it is a virus [closed]

How to fix it (so that the circle does not show that it is a virus). I do not know what to do Please help me (lots of characters to make it 220)(lots of characters to make it 220)(lots of characters ...
Саша Миронюк's user avatar
2 votes
0 answers
23 views

GStreamer 1.24 Python bindings are blacklisted

I am trying to install Python bindings for GStreamer, but the library is blacklisted. My Dockerfile is below. Everything installs without issue, but the libgstpython.so library is blacklisted. I have ...
mentoc3000's user avatar
0 votes
0 answers
23 views

How to use knn imputer on both training and test

I have a dataframe df and I am dividing it into df1 and df2 randomly. So, the row index for df1 and df2 are not ordered. I wanna use knn imputer to fill missing values in both of them. I am using the ...
Amin's user avatar
  • 127
1 vote
0 answers
9 views

Why OpenCV module always show error on Streamlit Cloud deployment?

While deploying streamlit app on streamlit community cloud at share.streamlit.io, OpenCV module not found error always shows up, even after mentioning it to the requirements.txt file correctly. While ...
Sambhav Gupta's user avatar
0 votes
0 answers
9 views

Huggingface Custom Pipeline + Langchain Question

I'm developing a RAG POC using Langchain. My project builds a custom huggingface pipeline(subclass of TextGenerationPipeline) and inferences with the pipeline are fine. But when I trying to build a ...
azerw's user avatar
  • 1
1 vote
1 answer
37 views

What is the correct type annotation for "bytes or bytearray"?

In Python 3.11 or newer, is there a more convenient type annotation to use than bytes | bytearray for a function argument that means "An ordered collection of bytes"? It seems wasteful to ...
Charles Nicholson's user avatar
-2 votes
1 answer
37 views

Why do I keep getting typeError must be integer?

import csv import os main_csv = os.path.join("..","Pypoll", "Resources", "election_data.csv") dataFile = os.path.join("BallotAnalysis....
Mr Dragan's user avatar
-4 votes
0 answers
37 views

Create an Array with the following numbers: 0, 1, 2, 3, 4, 5, 6 [closed]

Create an Array with the following numbers: 0, 1, 2, 3, 4, 5, 6. I don't know what it's supposed to look like and I've tried other solutions but they are wrong. I don't know how to make an array of ...
Erica's user avatar
  • 1
-3 votes
0 answers
37 views

why are range(-len(data),0,1) and range(0,0,1) different in Python

Lets take the following example data = "silly walks" for j in range(-len(data),0,1): print(data[j],end="") print() The above prints silly walks If we change it to data = "...
Ananth Raghuraman's user avatar
0 votes
0 answers
16 views

Change the folder with python scripts under Windows

I’ve installed the latest version of python under Windows 10 to c:\python312. However, when I install some python modules via pip they appear not in this folder, but in %APPDATA%\Python\Python312. Is ...
Victor's user avatar
  • 1
0 votes
1 answer
18 views

Is it possible to convert an image into a Tkinter Label?

I am quite inexperienced programing with Python and using the many available libraries for Python. I would like to be able to place an image /label at a location on a Tkinter window. I've been ...
SteveB's user avatar
  • 11
0 votes
0 answers
7 views

Cannot load ttf font file with reportlab, throws OSError

I want to load a custom font in my PdfCreator class which uses reportlab to create these Pdfs. When I initialize the class, I define the font path and name, but when executing I only get a lot of ...
Sloth404's user avatar
-1 votes
3 answers
35 views

how can i use input values in another method? [duplicate]

I put inputs in read(): function below, but other functions like calculate(): and write(): can not define the inputs. anyone can help me please? def read (): foot = int(input("Foot?")) ...
sina mostafidi's user avatar
0 votes
0 answers
18 views

KeyError: "['Outcome'] not in index"

import seaborn as sb import researchpy as rp tips = sb.load_dataset("tips") tps = tips.copy() tps.head() I have this data set, rp.summary_cont(tps[["total_bill","tip",&...
Neslişah Öztürk's user avatar
0 votes
0 answers
6 views

How to install sql files in package directory with setup.py

My python project has the following structure: . ├── my_module │   ├── __init__.py │   └── some_code.py ├── sql │   └── some_dir │   ├── some_query.sql │   ├── sub_dir │   │ └── ...
Mr. Developerdude's user avatar
0 votes
0 answers
14 views

Issue when padding and packing sequences in LSTM networks using PyTorch

I'm trying to make a simple lstm neural network. I've got time series data which I am splitting into sequences and batches using Pytorch's Dataset and DataLoader. To account for the variable lengths ...
D Danne's user avatar
  • 15
0 votes
0 answers
8 views

How to send email with msgraph SDK from Python

I am trying to build an application which processes and resends messages from a user's mail inbox. I tried following the sample code (below). It seems, however, that one of the .py files referenced in ...
user480840's user avatar
2 votes
3 answers
29 views

Polars - check for null in dataframe

I know I can do .null_count() in Polars, which returns a dataframe telling me null count for each column. d = {"foo":[1,2,3, None], "bar":[4,None, None, 6]} df_polars_withnull = pl....
user3240688's user avatar
  • 1,258
-1 votes
0 answers
13 views

Tracking dynamic memory address with pointers, offset and python

import ctypes import psutil import time def get_process_id_by_name(process_name): for process in psutil.process_iter(['pid', 'name']): if process.info['name'] == process_name: ...
pooD's user avatar
  • 1
1 vote
0 answers
16 views

Filter overlapping time periods using sqlalchemy for mySQL

I'm having soo much trouble trying to make this work. Im developing an API where there are activities (called 'Session' in the model), those have two time related attributes, DATE (the initial ...
Chunchun's user avatar
0 votes
0 answers
7 views

Django - How to filter model objects by certain attribute and use it for front-end?

I am a beginner and building a website to showcase wines. This is the model for Wine: class Wine(models.Model): name = models.CharField(max_length=100) type = models.CharField(max_length=50) ...
Ben's user avatar
  • 33
0 votes
0 answers
5 views

pyside6 Qchart line series show points value

I'm new in pyside6 and I'm trying to visualize some data in a line chart but it's a little bit bad because points value not appear is there any way or any trick I could do to show the point or show ...
B.oualid's user avatar
0 votes
0 answers
20 views

Text-based game code not matching up with player input

My patience has been lost, as I have been sitting at my desk for 3+ hours trying to figure out why the heck my game won't move me from the starting room despite everything seemingly working correctly. ...
Mike E.'s user avatar

1
2 3 4 5
43887