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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
3 views

Could not build wheels for record3d, which is required to install pyproject.toml-based projects

Working on streaming LiDAR data from my phone to my PC and i run into this error when i try to run "pip install record3d" I get an error. I'm relatively inexperienced with these kinds of ...
Goober's user avatar
  • 1
0 votes
0 answers
3 views

Nonetype-TypeError: Python

The program runs for one maybe two calls on it then this, Exception ignored on calling ctypes callback function: <function catch_errors.<locals>.call_with_this at 0x00000205A84C5630> ...
Reece Baynes's user avatar
1 vote
2 answers
17 views

numpy random number generator: I'm using the same seed, but I'm not getting the same sequence of numbers?

I am generating multiple grids with simulated data (elevation), and as part of that, I add or subtract elevation (according to a function of distance from a center point) from select points. I want ...
Bambi's user avatar
  • 9
0 votes
0 answers
3 views

400 MSG_ID_INVALID for GetMessageReactionsList in Pyrogram

I wrote a script to collect data using Pyrogram but got the error 400 MSG_ID_INVALID on some messages. I didn't notice a pattern why some messages cause errors and others don't. Maybe the problem is ...
Milena's user avatar
  • 35
0 votes
0 answers
10 views

ModuleNotFoundError: No module named 'simple_history' Pythonanywhere

I have a Django app running on pythonanywhere server. I have installed the requirements.txt and everything is okay, python manage.py migrate also successfully done. now when I reload my app I get ...
HBNmughal's user avatar
0 votes
0 answers
12 views

Compare key items in a list not a dictionary that are same in order to calculate those same line items for a final result

The way this list came to life was from an excel document I created that sheet 1 has channel numbers and sheet 2 has wattage values for if channel is in between a low and highValue. In trying to keep ...
iSpeedyG's user avatar
0 votes
1 answer
11 views

Docker Error build during Deployment on Railway services

please I had previously deployed my Django project on Railway which worked fine. Unfortunately, when I tried to add up SendGrid mail functionality by using django-sendgrid-v5 package to help me handle ...
Blaisemart's user avatar
0 votes
0 answers
6 views

Pygame/Pillow GIF-reading issue. Please help! The pillow library stops working when I change the dictionary that it reads files from

I am trying to create a program that will display 3 gifs at a time in pygame. I got everything working with 3 gifs, but when I try to switch out 1 gif with another, I get errors with the pillow ...
Jason Brickman's user avatar
-1 votes
0 answers
18 views

MultiValueDictKeyError at /register [closed]

I keep getting this whenever I try to register a user on my test website using Django please can anyone help me out MultiValueDictKeyError at /register 'email' Request Method: POST Request URL: ...
James 's user avatar
-1 votes
1 answer
25 views

Python regex to match string not preceded by another string, but with other words in between

I tried the accepted answer to Regex match word not immediately preceded by another word but possibly preceded by that word before but that didn't work. >>> re.search('(?<!nonland) onto ...
Cees Timmerman's user avatar
0 votes
0 answers
6 views

Nothing happens when I try to use python to update excel

After updating some of the details in the StringVar and IntVar variables, I'm trying to then have those values update the cells in the excel spreadsheet at the given row/index number. When I click to ...
Tyler Bishop's user avatar
0 votes
0 answers
26 views

How to write to dictionary using user input and loop and parsing by space?

I am trying to create a dictionary that I can serialize into a json file. This is my first time trying this so I am very confused. I want user input for a patient's first name, last name, age, and ...
prina sikowitz's user avatar
-1 votes
0 answers
20 views

how do I create a loop correctly in python

I am writing a calculation program and my code considers at the first start Nr and Nf are equal to 0 , after the first cycle they should be assigned values from these lines for i in range (1,n): NOr = ...
AdrenaliN 228's user avatar
1 vote
1 answer
20 views

Is it possible to do infix function composition in python without wrapping your functions in some decorator?

Title says it all. Seen lots of answers where folks have implemented f @ g, but this requires wrapping f, g in some infix decorator or class. Is it possible to get this to work? Maybe by patching some ...
lanf's user avatar
  • 256
0 votes
0 answers
10 views

how to iterate a datafrme to do "dynamic" join in pyspark

I have a dataframe contains different toxic combination of permissions, I want to iterate that so that it can find all the person who should not be having those toxic combination in the first place. ...
Williams Jr's user avatar
0 votes
0 answers
18 views

Python Overflow Implementing TD Learning

Attempting to implement td lambda on cliffwalking gym environment but I am getting exploding V function values presumably because of overflow. Interestingly enough, the overflow only happens when ...
jroc's user avatar
  • 1
0 votes
0 answers
17 views

I'm trying to extract an image from a website using python

I need to extract or "scrape" a specific image source off of a website using nothing but the url that the image is being hosted on. For example (and experimental purposes), I would like the ...
Brayden Baines's user avatar
-1 votes
0 answers
6 views

How to pickle an H2O model in python?

I need to pickle an H2O model for implementation. What is the best way to do it? I loaded the binary model using h2o.load_model(); however, I got the following error when trying to unpickle it: ...
soniCYouth's user avatar
0 votes
0 answers
19 views

Rotate Array, python challenge

QUESTION :Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. Example 1: class Solution(object): def rotate(self, nums, k): x = len(nums) - k ...
jaafar yousssef's user avatar
0 votes
0 answers
10 views

PyMongo: How To Search Long value by int value

I'm new in both MongoDB and python, and just trying to play with them. In my one of the first experiments I've faced with some weird thing. I have an upsert call like this: def update_value(...
Andrey_Murgin's user avatar
0 votes
1 answer
47 views

Card Hand evaluation

I am absolutely stuck on what to do to get this to work. What you will see in the four of a kind function is what I am currently trying to do, the other hands represent my partners take on the problem....
Spills's user avatar
  • 11
0 votes
0 answers
7 views

QListView with QSqlTableModel - Access selected item

I have a QApplication displaying a QListView filled from my_database.db and a QSqlTableModel. I want to know which item of the list is selected when clicking on a pushButton. How can I know which item ...
AlMa's user avatar
  • 199
1 vote
0 answers
24 views

Running a bash script that includes java commands from a python program

I have java code corresponding to a policy mining algorithm in a repository and have to execute this using commands on the git bash terminal (Using a Windows PC). I have generated test data and stored ...
Gaurav's user avatar
  • 11
1 vote
0 answers
17 views

How to write to Delta Lake using "zstd" compression codec in AWS Glue?

I have AWS Glue job. It is using "Glue 4.0 - Supports spark 3.3, Scala 2, Python 3" version. It reads individual parquet files and write to Delta Lake. I am using "write.parquet....
Hongbo Miao's user avatar
  • 45.5k
0 votes
0 answers
30 views

How do I read information from a .json file and use that info to rename other files?

Here's what I'm trying to do: Read .JSON files from within a folder and its respective sub-folders. Pull out a specific array that looks something like this: "MediaList": [ { ...
Angry Crow Man's user avatar
2 votes
1 answer
16 views

How do I concatenate columns values (all but one) to a list and add it as a column with polars?

I have the input in this format: import polars as pl data = {"Name": ['Name_A', 'Name_B','Name_C'], "val_1": ['a',None, 'a'],"val_2": [None,None, 'b'],"val_3": ...
Shankze's user avatar
  • 3,845
0 votes
0 answers
7 views

How to convert multiple telethon session files(.session) into single tdata folder with python?

I have multiple sessions files (.session) for telethon. I need to gather 2 or 3 of them and convert into single tdata folder. This means that i want to create tdata folder,with which opened desktop ...
alex sasai's user avatar
0 votes
0 answers
6 views

gRPC - Keep a stream connection alive in Python

I am trying to convert a C# app into a Python app and I am having issues with gRPC. I need to keep a stream connection alive while the application is running, this app receive broadcast messages from ...
McNets's user avatar
  • 10.4k
1 vote
0 answers
14 views

Can't run a .py file AttributeError: module 'collections' has no attribute 'MutableSequence'

I have a ubuntu server and am trying to run a website using python w/ flask Running Python 3.11.4 I run the command: python app.py Expected behavior: It should execute the without error. I get the ...
Pyro's user avatar
  • 11
0 votes
0 answers
25 views

how to pass a string variable in django urls?

so i made a variable named urlname in my django model and want to pass it in my urls like this: path('example/<str:url>/', views.example, name='example'), and in my views i did this: def ...
Parsa's user avatar
  • 1
0 votes
0 answers
6 views

Python Flet have parent expand but child should not

I am using Flet as the GUI library for my project. I have the following code: MAIN_GUI = ft.Container( margin=ft.margin.only(bottom=40), expand=True, content=ft.Row([ ft.Card( ...
Programer Beginner's user avatar
0 votes
0 answers
4 views

Trying to run UDP client server program in python involving a broker(the server), a producer(client) and a subscriber(client) with docker containers

When I run the containers and then run the corresponding python files in their terminals they don't communicate with each other like they are supposed to. I am confident that my docker networking is ...
JohnD's user avatar
  • 1
0 votes
0 answers
13 views

Python customtkinter messagebox() [closed]

How to cause a sharp error window in this library?Please help Google didn't give anything, p s I'm a beginner just learning. Don't beat ;c Example on tkinter tkinter itself.messagebox How to cause a ...
0 votes
1 answer
14 views

How to prevent the user from changing some fields in Django Rest?

My Django REST application has an entity where during creation/update some fields are set by the backend and not by the user, but the user can still submit requests to update these fields. Fields to ...
lengthylyova's user avatar
0 votes
1 answer
28 views

How to read an excel file with rows as columns and columns as rows with Pandas in Python?

I have the following problem: I want to read an Excel file that was changed in its original form, using columns as rows and rows as columns (in this way the size of the excel file is reduced a lot, ...
Leober Ramos's user avatar
0 votes
0 answers
10 views

TypeError: _named_members() got an unexpected keyword argument 'remove_duplicate'

I'm working on Supper resolution using GAN project and I'm trying to train SRGAN but I'm getting one error: [TLX] Linear linear_1: 1 No Activation [TLX] Conv2d conv1_1: out_channels : 64 kernel_size: ...
krishna veer's user avatar
0 votes
0 answers
11 views

API token session expired every 3 days

I am new to programming but I would like to ask about API. I am using a third party API token and bearer: auth, where it will expire every 3 days then I have to generate a new API token. I was ...
user10518674's user avatar
0 votes
2 answers
33 views

How to pad 0s to garantee same length while iterating over two lists?

My inputs are : x = ['A', 'B', 'B', 'C', 'D', 'D', 'D'] y = [ 4 , 3 , 5 , 9 , 1 , 6 , 2 ] And I'm just trying to make this dictionnary. {'A': [4, 0, 0], 'B': [3, 5, 0], 'C': [9, 0, 0], 'D': [1, ...
VERBOSE's user avatar
  • 167
1 vote
0 answers
7 views

Python docx2pdf cannot convert docx to pdf when bundled with pyinstaller

I am using Customtkinter to build GUI which reads data from an excel file, then creates a word document with this file, converts it to pdf and encrypts it. I am using the python-docx module to write ...
ignaboadi's user avatar
0 votes
1 answer
11 views

VOLTTRON set_point

I am trying to use the actuator agent to write to a building automation point with set_point. This is the a snip from my Python code: _log.info(f'{log_prefix} - meter_topic: {meter_topic}') ...
bbartling's user avatar
  • 3,308
1 vote
1 answer
48 views

String length comparison to an integer seems to return wrong answer

I'm working on a LeetCode problem (880. Decoded String at Index) where I need to decode a string following specific rules, and I've come across an issue that I don't understand. I'm using a loop to ...
Tumasotis's user avatar
0 votes
0 answers
29 views

The maximum value of input_ids (50257) must be smaller than the embedding layer's input dimension (50257)

I am trying to create a categorical model that produces one of the three result for some data input: True, False, Invalid. as mentioned in the title I get this error when I try to evaluate the model, ...
Ghazi's user avatar
  • 603
0 votes
1 answer
48 views

How to create a list of the most common key in a dictionary? [duplicate]

I have a dictionary which is as follows, titled city_dict: {'Jacksonville': 4, 'Shanghai': 7, 'Houston': 3, 'Los Angeles':3} I want to put the cities with the highest counts (values) in a list. I ...
prina sikowitz's user avatar
0 votes
0 answers
22 views

Unable to build package Python

I am unable to build my Python package. I have barely changed any code and it used to work months ago. When running python setup.py sdist it doesn't create a new .tar file for the package distribution....
Walker's user avatar
  • 121
0 votes
1 answer
24 views

Error when trying to create a list of files

I have a folder that contains 20 csv files. Each file has about 10 columns and thousands of rows. The csv files look something like the following: gene p-value xyz acan 0.05 123 mmp2 0.02 456 mmp9 ...
Adriana's user avatar
  • 93
0 votes
0 answers
18 views

A Rectangle must have a non-negative height

I am trying to generate an invoice from a firebase payload in a gcp function using borb. The error I am getting is that the rectangle must have non-negative height. The gcp function is: from borb.pdf....
prf34's user avatar
  • 1
0 votes
1 answer
28 views

How to Normalize JSON data into a pandas dataframe with json_normalize

I'm trying to transform this complex object into a pandas dataframe data={ "customers": [ { "a": 'true', "addresses": [{"city&...
Herojos's user avatar
  • 63
0 votes
0 answers
6 views

Trying to retrieve Region(State) and City and Campaign Metrics from Google Ads campaigns

Im trying to make a GAQL to retrieve some data like Clicks, Impressions from my campaigns separated by City and State (Like NY or FL or CA) I'm using Python and google-ads = "^21.3.0" to ...
Matheus Suffi's user avatar
0 votes
0 answers
7 views

Azure Functions Blob is triggered 5 times

Since we switched to Azure Functions with the Python V2 programming model, we experience a lot more problems during and after deployment then before. One that keeps puzzling me is that a blob trigger ...
pietz's user avatar
  • 2,133
0 votes
0 answers
11 views

Python method to multithread two vastly different timed functions for MQTT

i have an application that samples two IOs at vastly different rates that need to operate within an MQTT reporting loop that sends messages every 5secs. one function must sample every 10ms and ...
WhiteRau's user avatar
  • 818

1
2 3 4 5
43319