
Stack Overflow » Python
2,092 FOLLOWERS
Learn here to write a python program, ask version-specific Python questions, or chat about anything involving python programming.
Stack Overflow is empowering the world to develop technology through collective knowledge.
Stack Overflow » Python
28m ago
When i try to open thonny, it shows the following error.
Traceback(most recent call last):
File "<string>", line 3, in <module>
File
"C:\Users\USER\AppData\Local\Programs\Python\Python38-32\Lib\run.py", line 201, in run_module
mod_name, mod_spec, code = _get_module_details(mod_name)
File
"C:\Users\USER\AppData\Local\Programs\Python\Python38-32\Lib\run.py", line 136, in _get_module_details
raise error("No module named %s" % mod_name)
ImportError: No module named thonny
Versions:
OS: Windows 7 64-bit
Python: Python 3.8.10(32bit)
Thonny:4.0.1
Any help in this matter is appr ..read more
Stack Overflow » Python
28m ago
I would like to extract the data from plot images using python. The image will look like this and sometimes it will contain 4 quadrants enter image description here
I have tried using different plot digitizer but no luck .
Is there any framework in python to do it ..read more
Stack Overflow » Python
28m ago
import os
with open('files.txt', 'w') as f:
for filename in os.listdir('.'):
if filename.endswith('.py'):
with open(filename, 'r') as py_file:
f.write(py_file.read()) # No newline
I was expecting for it to open files.txt and at least print something in it but it didn't happen ..read more
Stack Overflow » Python
28m ago
I'm hitting a tableau api which return image/png mime type in response, this is the api i am trying https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_workbooks_and_views.htm#query_view_image when i hit this api via postman i get the correct and complete image of the dashboard i am expecting
but i hit the same api in python and save the image in local i am getting incomplete or distorted image
python code for craeting this png file in local
# Create the request headers.
headers = {
"X-Tableau-Auth": token,
}
# Make the request.
response = requests.get(mis_endpoint, h ..read more
Stack Overflow » Python
28m ago
I am trying to get information from Twitter using Twitter API. I am trying to build a dashboard where I can display all the information which I can extract. Here's the below code I am using for the same:-
import requests
from tqdm import tqdm
import pandas as pd
import tweepy
from datetime import date
consumer_key = '*****************'
consumer_secret = '*****************'
access_token = '*****************'
access_token_secret = '*****************'
bearer_token = '*****************'
client = tweepy.Client( bearer_token=bearer_token,
consumer_key=consumer_key ..read more
Stack Overflow » Python
28m ago
When running my MoveNet on live feed from Webcam the points are too high for my shoulders when the subject is showing only face and top of shoulders. When subject moves back, the keypoints are good for the shoulders but the eyes are too low and the arms are not fully extended to the wrist (they stop at the elbow). I am using the Macbook Pro 13in with the M2 chip. Here is my code:
import numpy as np
from matplotlib import pyplot as plt
import cv2
import tensorflow as tf
EDGES = {
(0, 1): 'm',
(0, 2): 'c',
(1, 3): 'm',
(2, 4): 'c',
(0, 5): 'm',
(0, 6): 'c',
(5, 7 ..read more
Stack Overflow » Python
28m ago
from selenium import webdriver
import time
driverPath = "C:/Users/陳子雋/Desktop/Coding Projects/爬蟲/chromedriver.exe"
browser = webdriver.Chrome(driverPath)
url = input()
browser.get(url)
How can I open an url that input by user ..read more
Stack Overflow » Python
2h ago
I am trying to save a result of Voronoi diagram that allow incremental point adding. The Voronoi diagram is compiled with around 106 points in 2D. I'd like to save the result to file for future use as I see a bit costly to reconstruct the diagram every time I use.
The operation that I would like to perform on this prepared geometry is to add a single point and recalculate the Voronoi diagram, and that's why the incremental option is used below. Because the prepared geometry will be reused many time, I am now looking for a way to store the geometry as a file.
My first attempt is with scipy.spat ..read more
Stack Overflow » Python
2h ago
I am unit testing a single line of code within an if statement where I append an item onto a list if a variable has a specific value.
foo = []
if bar == 'a':
foo.append(bar)
I would like to assert that such an append has been called. I have patched methods from a variety of sources before, but not methods belonging to basic Python data types. What class would I specify as the path for the mock.patch decorator?
@mock.patch('append')
def test_appends_bar_to_foo(mock_append):
assert mock_append.called
With the above code, I get TypeError: Need a valid target to patch. You supplied: 'a ..read more
Stack Overflow » Python
2h ago
I am attempting to take a table similar to the below raw data example with punch-in and punch-out times and convert it to a table (desired format below) which will allow the data to be easily used in Power BI area charts (this data will be plotted with transaction data). Essentially, I'd like to take raw punch time data and place it on a matrix to then count the number of employees "on the clock" per 15-minute interval.
I am open to the toolset to complete this in the simplest manner. Excel, Python, SQL Server, and Power BI are my strongest platforms. Also, open to a better way of achieving th ..read more