Category "python"

Proper use of pool.map

I have an asynchronous function that checks if the token is valid. I want to count how many working and non-working tokens. Also I use aiomultiprocess. The code

Cannot import name 'get' from partially initialized module 'requests'

I have problem with requests package. In past requests was working, but today for no reason it stopped working. I am just importing requests and it cause error.

how to get the caller's filename, method name in python

for example, a.boo method calls b.foo method. In b.foo method, how can I get a's file name (I don't want to pass __file__ to b.foo method)...

Is there any way to print the pytest parameter names

Whenever pytest is outputting the tests that it has, it always prints out the parameter values, but never the names of the variables. For example: PASSED test_c

Grab the first entry from json [duplicate]

I apologize ahead im really bad at explaining things. I have a variable with json data in it, the first entry in this json data will change bu

Proper use of pool.map

I have an asynchronous function that checks if the token is valid. I want to count how many working and non-working tokens. Also I use aiomultiprocess. The code

ModuleNotFoundError - Installing PyCharm and Anaconda [duplicate]

I'm setting up PyCharm and Anaconda on a new computer and am running into errors saying modules are not found. I've confirmed that the module,

Problems installing the python library for salvus

I'm having some problems installing the Python library for salvus (see installation instructions). When I use Conda to configure the salvus environment, the fin

How can I use Gaussian Mixture to fit 2 gaussians in my data?

I'm trying to fit 2 gaussians in my red/blue population data. But it does not fit. What am I doing wrong? The code is: mag1 = 'z' mag2 = 'y' mask_rich = (wazp_m

I have this error which says that there is no "wrapper" in the module curses

import curses import os from curses import wrapper # import Wrapper as Wp def design(stdscr): try: curses.init_pair(1, curses.COLOR_RED, curses.CO

I created a file and stored some value there. When i opened the file in read mode and printed read(33) and printed tell() its showing as in below:

[enter image description here][1] I created a file poem.txt a stored a poem: There is freedom waiting for you, On the breezes of the sky, And you ask,"What if i

Newbie Glade user confounded by radio buttons

I have a Glade GTK Gui which is meant to be a Front End for a CLI program I wrote a couple of years ago. There are a number of fields for the user to fill in. T

How to write to a file without overwriting current contents? [duplicate]

with open("games.txt", "w") as text_file: print(driver.current_url) text_file.write(driver.current_url + "\n") I'm using this code r

seaborn joint plot not working with logarithmic axes

I'm trying to plot via: g = sns.jointplot(x = etas, y = vs, marginal_kws=dict(bins=100), space = 0) g.ax_joint.set_xscale('log') g.ax_joint.set_ys

Extracting contours bounding boxes for ROI's from image using opencv [duplicate]

I am trying to extract bounding boxes from this form image. The Bounding Boxes in my case are all the boxes in the image. My approach was to F

Need to remove a particular file of size 0 from a directory

Need to remove a particular file of size 0 from directory, can anyone help me on that? The code i have tried is for f in source_images: file_path = os.pat

Invalid Argument Error / Graph Execution Error

I'm having multiple errors while running this VGG training code (code and errors shown below). I don't know if its because of my dataset or is it something else

Configuring reticulate to use conda environment

I'm trying to get R's reticulate package to detect the Python interpreter in one of my conda-environments. Following several posts and questions, I've attempted

How can I change the pool ball detection code to OpenCV to remove the shaking?

I'm using pool ball detection with the HoughCircles function in OpenCV. import numpy as np import cv2 as cv cap = cv.VideoCapture(1) if not cap.isOpened():

How do I monitor a different folder (than the default) within Outlook for new mail (and then fire an event) with Python

I have the below code import win32com.client import pythoncom import time class Handler_Class(object): def OnNewMailEx(self, receivedItemsIDs)