Skip to main content

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. Note that Python 2 reached end-of-life on January 1st, 2020. For version-specific Python questions, add the version tag (e.g. [python-3.x] or [python-3.9]). 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
7 views

'django-admin' is not recognized as an internal or external command, operable program or batch file

Yesterday I installed Python and added it to PATH. Then I created a virtual environment using virtualenv. I then activated the environment and pip-installed django (using pip install django) and ...
Mahdi Shirazi's user avatar
0 votes
1 answer
16 views

Pip version trouble in pycharm

So, I want to start a new project in pycharm and it always starts with an outdated version of pip and I have to do the upgrade. It's not really a problem for a project, but it's getting annoying for ...
marc.mitrasca's user avatar
0 votes
0 answers
4 views

Multithreading TFRecord writing stops abruptly on kaggle notebook

I'm reaching out for some help regarding multithreading for TFRecord writing in Kaggle notebooks. I'm currently working on the VGGFace2 dataset and aiming to convert image pairs into TFRecords for ...
Frontman's user avatar
1 vote
0 answers
12 views

Fetch likes from Instagram reels

In an attempt to study Benfords law, I'm trying to get a list of the likes on recommendet Instagram Reels. So the plan is simply to open Reels, fetch the Like Count, swipe to the next Reel and repeat ...
haifisch123's user avatar
1 vote
1 answer
16 views

Python: Selenium's driver.find_element(...) cant find the button im looking for:

This code is supposed to click a button (accept the cookies) and then take a screenshot of the page. It takes the screenshot of the right element with the right height & width, but it does not ...
FireFly's user avatar
  • 13
0 votes
0 answers
6 views

export an openhermer model to onnx

i am trying to export teknium/OpenHermes-2.5-Mistral-7B to ONNX, this is my code : import torch from transformers import AutoModelForCausalLM, AutoTokenizer import onnx model_name = "teknium/...
mohammed yazid Berrached's user avatar
0 votes
0 answers
12 views

I'm trying to build a nand2tetris assembler but the ply.lex library in python keep breaking my assembly instructions to different lines

the first thought I had was that I didn't manage to handle the new line character properly because it keeps throwing the new line character "\n" whenever I try to append the instructions for ...
ali eltaib's user avatar
0 votes
0 answers
10 views

How to remove a widget from a screen

I'm trying to make a screen with textinput a btn and a recycling view. The btn add to the recycling view a card with the text of the textinput, each card has a trash-bin button to remove the card and ...
TestFour's user avatar
0 votes
0 answers
5 views

photoshop-python-api says that I may not have photoshop installed correctly

I'm trying to write code that will take data from an excel spreadsheet and fit it into certain layers in a psd file.Here is my code: import pandas as pd from photoshop import Session import os def ...
RandomnieBukvi 's user avatar
-1 votes
0 answers
23 views

error with to_list() function on first run (python)

I'm working on a sentiment analysis project related to gemini on google co.lab. one of the steps is where I isolate a column containing ios app reviews, transforming it into a list and cleaning it of ...
tim_toaster's user avatar
0 votes
0 answers
13 views

Yes/No Popup on PySimpleGUI

How do I use yes/no popups on PySimpleGUI? I've searched everywhere, but the answers just aren't clear on this. At the moment, I am just trying to make a simple yes/no program so I can get my head ...
user26149746's user avatar
1 vote
0 answers
9 views

running monte carlo simulation on AWS EC2 instance

I would like to ask a general advice how to implement a monte carlo simulation on AWS remote server My monte carlo simulation is a python script using other python scripts for functions, and outputs ...
Martin's user avatar
  • 23
0 votes
0 answers
9 views

Blender Robotic control Python code giving wrong angles?

I made a code for my ESP32 to control my robotic arm ( 5 Axes ; 5 steppermotors ) when it gets coordinates through the serialport like e.g.: "1000, 1000, 1000, 1000, 1000. Then, I have code in ...
Mr. Sunny's user avatar
0 votes
1 answer
28 views

Python Pandas how to plot multiple colmuns on x axis?

I have a dataframe that looks like this: import pandas as pd data = {'Floor': [1, 2, 3, 4], 'IDR 1': [15, 6, 7, 9], 'IDR 2': [36, 12, 78, 23]} df = pd.DataFrame(data) df: Floor IDR 1 IDR 2 0 ...
Hür Doğan ÜNLÜ's user avatar
0 votes
0 answers
9 views

Plotly Express: Remove Trendline from Marginal Distribution Figures

I'm looking for a "clean" way to remove the trendline from the marginal-distribution subplot created using plotly-express. I know it's a bit unclear, so please look at the following example: ...
Jon Nir's user avatar
  • 551
-1 votes
0 answers
9 views

how to convert custom dataset polygon annotation format saved in .xml format. I need to convert .xml to coco json format. please find below format

<?xml version="1.0" encoding="utf-8"?> <annotations> <version>1.1</version> <meta> <job> <id>1015773</id> <...
M Subhadra's user avatar
0 votes
0 answers
23 views

How to make a subprogram return to the main program

Im creating a rock paper scissors game which consists of a subprogram containing the single player game, which is stored on a different file and imported to the main program which runs it. In the ...
user26366849's user avatar
0 votes
0 answers
20 views

How to solve the following problem for method where we have other

Question: A point represents a location in a two-dimensional space, characterized by its x and y coordinates. Here is the partially completed Point class that you will be working with: class Point: ...
Pratap M Naik's user avatar
0 votes
0 answers
7 views

How to Log in to a Discord Bot with SOCKS5 Proxy Authentication

I am trying to log in to a Discord bot using a SOCKS5 proxy with authentication. Here is the simple code I am using to log in without the proxy: import discord TOKEN = "YOUR_BOT_TOKEN" ...
user26366765's user avatar
2 votes
2 answers
41 views

How to print palindrome pattern without using any string method

I am currently stuck not getting how do i need to print the below pattern without using any string method or any string properties and not even any thing which direct or indirectly associated with ...
quora question's user avatar
0 votes
0 answers
12 views

How to correctly get the coordinates of the cursor relative to the parent element?

Problem: There are 2 events - imgMousePressEventand imgMouseMoveEvent. When I click on the first one, I get the coordinates of the cursor's starting point. Then, when the left mouse button is pressed, ...
0_o's user avatar
  • 5
0 votes
0 answers
10 views

Experiencing an error when trying to import from a diffrent directory

i am trying to import a function from another file a/b/c.py a/1/2.py i wanted to import a funciton from c.py in 2.py sys.path.insert(1, '/path/to/c/py/a/b/c') from c import function1, function2 i ...
Erdem Sarikaya's user avatar
1 vote
0 answers
7 views

response error when working on jupyter notebook for the purpose of extracting data on tweeter

tweets = [] try: response_json = connect_to_endpoint(search_url, headers, params) print("Response received successfully.") except Exception as e: print(f"An error occurred: ...
Olaitan Olupo's user avatar
0 votes
0 answers
9 views

Not able to activate virtual environment using python 3.12.0 in vs code

I'm working on webapp using python, django and html, css. For that I need to create a virtual environment for that i installed Python 3.12.0 and i run this command "py -m venv myenv" in ...
Kirtan Patel's user avatar
0 votes
0 answers
15 views

I keep getting errors with my machine learning model

It's just a version of a model i made which predicts stocks, when I run it, it works fine, but returns errors with the output, note indentations were messed up but its self explanatory This is the ...
SplooshM's user avatar
2 votes
1 answer
14 views

Is There a Way to Expose a Plot Generated Using a Pandas Dataframe as a Jupyter Notebook as an App to the End User?

Current Workflow Right now, me, as an ML engineer, am using a jupyter notebook to plot some pandas dataframes. Basically, inside the jupyter notebook, I am setting some hard-coded configurations like ...
Della's user avatar
  • 1,548
0 votes
1 answer
18 views

SignalIntegrity cannot import name 'math' from 'numpy'

I can not launch the SignalIntegrityApp GUI application I carefully followed the instructions in the website:https://github.com/Nubis-Communications/SignalIntegrity/wiki/Installation However, when I ...
Mohammad Lotfi's user avatar
0 votes
0 answers
8 views

I can't completely create a PyDev project in Eclipse

Whether I install PyDev as a plugin or as a web address from which to download the libraries in Eclipse, it always gives me the usual problem when I try to implement a project in Python. I can create ...
Davide Cecconi's user avatar
1 vote
3 answers
37 views

Why are all rows of my matrix the same as the last row?

Can someone please help me find fault in my code? If I create a blank 2D matrix with static initial value, it returns the correct transposed matrix. Whereas if I create a blank matrix using a for loop,...
Suyash Nachankar's user avatar
0 votes
1 answer
31 views

Logical error in sequence 011212201 question

I am trying to solve this following challenge: The example sequence 011212201220200112 ... is constructed as follows: The first element in the sequence is 0. For each iteration, repeat the following ...
Ananya Saxena's user avatar
0 votes
0 answers
19 views

How make a predictive Model to predict demands of different products

I am working on a supply chain problem where i need to predict how much material will be required in each quater to meet the demand . For each product we know what operation needs to be performed in ...
Tanmay Singh's user avatar
0 votes
1 answer
19 views

How to get data from NSE using python

I am trying to get data (file) from NSE website. Recently NSE changed the data format and switched to UDiFF format. But since then below sample code is not working. Can anybody give some thoughts on ...
Sunil's user avatar
  • 1
-1 votes
0 answers
19 views

TypeError: unsupported operand type(s) for *: 'c_char_Array_32' and 'int'

import comtypes.client from ctypes import byref, c_int, c_double, create_string_buffer, cast, POINTER, c_char_p try: SapObject = comtypes.client.GetActiveObject("CSI.SAP2000.API.SapObject&...
Joey Sedik's user avatar
1 vote
5 answers
37 views

How to sort by second value and match found sort by first value alphabetical - python

I have a scenario where i stuck not getting how do i need to implement. I have string need to find count of each letter -> ('a',2). Sort by second value which is count and order by first if same ...
quora question's user avatar
0 votes
0 answers
5 views

Redisearch not working with wildcard prefix

I am trying to understand why index_test works but index_test_wildcard does not work. The index created in the latter does not match to the records created within the function despite respecting the ...
Harry Stuart's user avatar
  • 1,883
1 vote
0 answers
16 views

Error 404 redirect not working in Django and static files not showing in edge

I am developing a single page webapp where I am trying to configure the error page if page not found so I have added proper settings but still my redirect not working on error page. Here is my ...
Chauhan Mukesh's user avatar
-1 votes
0 answers
28 views

Visual Studio Code is down [closed]

My operating system is macOS Big Sur Version 11.7.10 I don't know what happened but since 3-4 days ago "Visual Studio Code" stopped working on my system! This is so weird, I haven't ...
Abdul Hossein Charkhi's user avatar
-1 votes
0 answers
20 views

White Square Forming After PyOpenGL Texture Conversion from Pygame Surface - Problems with Vertices? [duplicate]

Image of White Square Specifically, I was attempting to utilize the glDrawArrays(GL_TRIANGLE_FAN, 0, 4) to form the screen surface after converting it from a pygame surface to a pyopengl texture. But ...
DryWall's user avatar
-1 votes
0 answers
25 views

Unable to open video with OpenCV python

I am unable to open a .avi video file with OpenCV python. In my head it is a very simple task, but for some reason, I am unable to open the file. When I run os.path.exists(<video_file_path>), it ...
Redwanul Haque Sourave's user avatar
0 votes
0 answers
9 views

Triggering action upon entering conversdation state with Telegram Python Bot Library

I want my bot to send out a message when entering a new state in the conversation handler. enter stage 1 -> "You entered Stage 1" enter stage 2 -> "You entered Stage 2" end ...
EC Goh's user avatar
  • 1
1 vote
0 answers
25 views

How to sample a population such that the sample has a given distribution of a variable?

Dataset #1 (ds1) has a particular distribution of a variable "mass". I would like to draw a sample from dataset #2 (ds2) such that the sample has a distribution of the "mass" ...
Kacper's user avatar
  • 23
0 votes
1 answer
27 views

Using scenedetect to spot subtle cut edits in a video?

I'm trying to use the Scenedetect Python package to detect subtle cuts in a video. For example, I'm looking at this video: https://www.youtube.com/watch?v=fNb_-Tmxq8Q I have downloaded the video and ...
garson's user avatar
  • 1,575
1 vote
1 answer
23 views

use different y values defined in another file

I have two py files named: randomvar.py and test_Random.py in the same folder. The file randomvar.py is given below: import numpy as np from test_Random import call_random def evaluate_expressions(...
Math's user avatar
  • 35
0 votes
0 answers
10 views

can not use woocommerce rest api

I'm using a true consumer key and consumer secret but when I send a request, I face this error with 403 status code: You don't have permission to access this resource my python code is: consumer_key = ...
farshadarbab's user avatar
0 votes
0 answers
17 views

Not a valid function in Taipy

I have this code block: from taipy.gui import Gui, notify import taipy.gui.builder as tgb import pandas as pd import os def read_data(filepath_or_url): try: if os.path.isfile(...
Akash sharma's user avatar
0 votes
0 answers
12 views

question about ipywidgets and running a different process

what is a better way to run this launching function separately from the ipywidgets process? from IPython.display import display from multiprocessing import Process from ipywidgets import widgets from ...
Anzing's user avatar
  • 1
0 votes
0 answers
21 views

Pyspark SQL not spliting column

I was trying to split my column using pyspark sql based on the values that are stored in another column, I saw that it didn't worked for some special characters. Here is my code: df = spark....
Sr Jefers's user avatar
  • 125
1 vote
1 answer
43 views

Is it a good practice to import functions from __main__.py?

My __main__.py module for my package is defined like so (simplified): def main(): ... # Start my GUI if __name__ == "__main__": main() It is also a package, with an __init__.py as ...
tomasvana10's user avatar
2 votes
2 answers
57 views

Python/Regex: Finding a specific pattern to update and then placing it back in the original text

I have a long file containing thousands of lines and a couple of samples are shown below: \begin{align*} H_0 \amp : \mu_1 = \mu_2 = \mu_3 = \mu_4 = \mu_5 \\ H_1 \amp : \text{Some text} \\ H_2 \...
M. Al Jumaily's user avatar
0 votes
0 answers
18 views

Horizontal Text Centering Issue in Customtkinter CTkTextbox

I am currently working with Customtkinter and facing an issue with aligning text horizontally within a CTkTextbox. Here's a snippet of my code: textbox = customtkinter.CTkTextbox(master=self....
dann's user avatar
  • 25

1
2 3 4 5
44051