Category "python"

`pymdownx.highlight` --- where do I find the "highlight" stylesheet used by syntax highlighting on fenced blocks?

I've been trying to write a Flask app which automatically converts Markdown into an HTML that will get served as the response. Consider the following toy snippe

Netmiko "Timed-out reading channel, data not available." for Juniper

I am using netmiko ConnectionHandler to push simple config to a Juniper device. But not sure why its throwing "Timed-out reading channel, data not available." t

Python pandas df.copy() ist not deep

I have (in my opinion) a strange problem with python pandas. If I do: cc1 = cc.copy(deep=True) for the dataframe cc and than ask a certain row and column: p

CyberArk ITATS004E Authentication failure for User in python script

I'm trying to implement a python script that executes local bash scripts or simple commands on remote CyberArk machines. Here is my code: if __name__ == '__main

ValueError: Shapes (None, 1) and (None, 3) are incompatible

I have a 3 dimensional dataset of audio files where X.shape is (329,20,85). I want to have a simpl bare-bones model running, so please don't nitpick and address

How to open a new tab using Python Playwright by feeding it a list of URLs?

According to the Playwright documentation, the way to open a new tab in the browser is as shown in the scrap_post_info() function? However, it failed to do so.

Selenium webdriver is opening the browser, but not opening the given url

This is the screenshot of the error I'm getting. I have recently taken up the task to learn functional testing and web automation using selnium webdriver with

Mock patch specific instance of class

How to mock a specific instance of a class using patch? In my test file I have: @classmethod def setUpClass(cls): cls.instance_of_my_class = myClass() one

Error while generating FCM token using django

This is error that i am getting in my javascript console: An error occurred while retrieving token. DOMException: Failed to execute 'atob' on 'Window': The str

use subprocess.run with check = True where the command is expected to return a non-zero exit code

When using subprocess.run it's recommended to use check = True (https://pycodequ.al/docs/pylint-messages/w1510-subprocess-run-check.html). However, there might

django redirect to form view and autofill with previously entered values

I have following scenario. User fills out a form If the user clicks the "continue" button and the form is valid the user will be redirected to a summary view In

Python - Multiple Clicks at different location on screen at the same time

I have this idea but I don't even know where to start haha Basically, Lets say I want to click these 2 locations (50, 100) and (1000, 500) I could just click

Python: nested dictionary is changing all values at once

I need to generate nested dictionaries, so I wrote the function create_nested: def create_nested(): key_dict = {} for key in ['key1', 'key2']:

Deploy Scrapy Project with Streamlit

I have a scrapy spider that scrapes products information from amazon based on the product link. I want to deploy this project with streamlit and take the produc

Getting "ValueError: 'outputs' must be defined before the loop." error while fitting model

I made a CNN model for training b/w images for training it on TPU on dimension of 100*100. Added the basic callback but after running it, it was giving outputs

Python variable inheritance/links

I observed something weird/new to me, which certainly comes handy in the moment, however I'd like to understand what's happening in the background, to avoid unw

How to JSONIFY a dict having a pydantic model

I am new to pydantic and am stuck. Below code is throwing error TypeError: Type is not JSON serializable: Person from pydantic import BaseModel,Extra from typin

Python mouse event for selecting multiple points on a graph

I am trying to select multiple points on a graph and move them. Right now I just have the singular mouse click event where I can click one point and move it, bu

Is it possible to run python scripts without python installed in Linux?

I once did something similar under windows, copying the whole python and specifying PYTHONPATH by a .bat script to make it work locally. But today I got a Linux

How can I save the metadata only of a dicom image, without the PixelArray?

I have a Dicom Image and I did read it with pydicom.dcmread('1.dcm'). how can I write just the metadata, without the pixel_array? either as dictionary, or as di