Category "python"

Azure App Service with AAD identity provider - Python & Streamlit framework for app - get logged in user

Have a web app developed in Python with the Streamlit framework. Deploying as an Azure app service. Authentication to the app is via AAD. I'm unable to get deta

How to deactivate a conda environment before the batch file exits when closing a jupyter lab instance?

I have a batch file that I use to run my jupyter lab. file.bat call <anaconda_dir>\Scripts\activate.bat rasa_ai_conda jupyter lab conda deactivate call co

Pydirectinput/Pynput/Pyautogui don't always press keys

So, I've been trying to make a macro for a game on Roblox and sometimes the inputs don't actually work? Why does this happen? I've tried this in pydirectinput,

Numba needs NumPy 1.20 or less for shapley import

I am trying to import shap. I am getting the following bug. I installed the lower version of NumPy still the problem is not solved. Thank you! import shap Im

How to understand closure in a lambda?

I want to make 5 buttons in a loop, and for each buttons bind a commend to print the index. In the following solution it always prints the same index. My code

How do I create a smtplib code that sends an 'Item in stock' email to a specific email address?

Using selenium I have a code that determines if an item is 'in stock' or 'out of stock'. The code can detect once an 'out of stock' item becomes 'in stock'. Usi

Multiple flask calls in single pytest having different databases

So I'm trying to test an endpoint in flask that I need to call multiple times in one test. The issue I am having is that on the second request the objects I pla

Is there a way to remove prevous prints?

So i am currently trying to make something that will print . and remove it then print .. and also remove it then print ... When i tried using sys module to remo

How to make an autoclicker in python?

I am trying to make a simple autoclicker, I want it so that if i press a command key, ('a' for example), it will hold down the down arrow for 10 seconds, then t

Apply formula on a column conditional to another column

import requests from geopy.geocoders import Nominatim import streamlit as st import numpy as np import pandas as pd import random, string print('ville :') code

How to find/calculate the shaded area of this shape in python?

I'm trying to write a python program to calculate the shaded area of the circle in this picture: [![enter image description here][1]][1] Here is the input and o

FastAPI: How to use POST data as variable to trigger another script?

I have written an API on FastAPI with filename api.py: from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Username(BaseMode

How to scrape similar/related accounts from instagram in python?

I am trying to scrape accounts which are similar/related to a given account in instagram. Querying URLS: https://www.instagram.com/{username}/?_a=1 doesn't prov

Convert list of objects to numpy array without coercing objects into array

I want to turn a Python list of objects into a numpy array of objects for easier manipulation of the list, e.g. index slicing, etc. However, numpy coerces list-

How to use code auto completion on the notebook of kaggle kernels?

I just run this code in one cell, but it don't work. %config Completer.use_jedi = False

C2059 syntax error: ',' after upgrading to Python 3.9 from Python 2.7

I have a C++ application that runs on Python 2.7, today I decided to upgrade to Python 3.9 but ever since then I've been getting the following error in visual s

Teams Invoke_response being rejected by Teams?

I have a teams app running on a standalone server with an AzureBot setup for message extensions on the app. I've got a class implementing message handling exten

Generate multiple new pandas dataframes using lists and for loops

I have the following dataframe: import pandas as pd import numpy as np from numpy import rec, nan df1=pd.DataFrame.from_records(rec.array([(202001L, 2020L, 'app

Unable to Connect to SFTP through paramiko

I am trying to establish a connection with an SFTP with paramiko. I was able to generate the known_hosts file in my local system by using ssh my.domain.com The

How do I call the functions for when I create the character class - Python - This is for a quiz game but using a tree traversal

#here I want to define the self.__tree but I am not sure how to do so, how would I create the tree? oijh0ij0ihoihihoihou