Category "python"

Shortest path Graph BFS python

Trying to return the int for shortest path in a graph, using BFS. The idea is to use a q, append into the q as [node,distance] and then when we traverse increas

PyQt6 QMediaPlayer and QAudioOutput not behaving as expected

I've been having an issue migrating to PyQt6 with QAudioOutput and QMediaPlayer where the QMediaPlayer object seems to not work with any QAudioOutput I make. If

The publishing code below is stalling on time.sleep() how can i change this behaviour + what would be a good way to implement a thread safe cach

For refreshing skills for a new job i have been trying to implement a very simple price publisher + client + mtm_cache. In the code below in publishing.py the c

Loop while basics in python 3

I am reading a python basics book and there is one function which I don't understand how it works. How is is possible that output looks like pow function even t

Issue with display()/collect() Large DataFrame In Pyspark

Getting The Following Issue In PySpark to perform display()/collect() operation on top of a generated dataframe. The df contains single column & Row (JSON d

Why do I get this error while calling predict in Keras?

I'm a newbie to Tensorflow, I've done many models but today when calling predict I get this error : ValueError: Exception encountered when calling layer "sequen

LABSE for bilingual sentence similarity

I am trying to run LABSE for bilingual similarity measurement. I am getting following error: AttributeError: 'tuple' object has no attribute 'pooler_output'

openpyxl problem Keyerror Content_Types.xml

I have a problem reading the code with openpyxl, until yesterday it works, and now it doesn't work anymore, I tried also with a backup copy but I have the same

how can i implement or convert a python code to javascript to be used with tensorflow js

how could I use this code in python with tensorflow js? it is to occupy it with a model that was trained with the dataset tf.keras.applications.ResNet152(input_

Flask sqlalchemy: how to draw two foreign key relationships to the same table

How would I go about creating the foreign key relationships for a very simple friend request database schema in flask sqlalchemy. Both the requester and request

How to optimise function logic to avoid duplication - python

I have some code below, for a given name that matches pattern with 2 lower case letters (such as 'aa'), the valid name can be V-aa or X-aa def verify_helper(val

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)...

How to get(extract) year, month or day from datetime.datetime(2021, 1, 25, 21, 20, 46) format? Python

could you please advice on this one? How to get(extract) year, month or day from datetime.datetime(2021, 1, 25, 21, 20, 46) format? For ex from the date (2021,

How To Access Repository Secret

I've made a repository on GitHub and have added a Repository secret. However, I can't seem to grab the secret's value. Any help would be greatly appreciated!

Django Image upload issue Cloundinary

I'm learning Django at present and just about getting to the deployment stage at hit a problem serving static/media with Cloudinary, following guides how to do

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

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