Quantcast
Channel: Active questions tagged python - Stack Overflow
Browsing all 23218 articles
Browse latest View live
↧

Is it possible to add a "InputField" in ChoiceField in Django?

I'm in the process of developing a form that aligns with a database model. One of the fields in this form requires users to select from a range of options.Initially, I implemented this using Django's...

View Article


Image may be NSFW.
Clik here to view.

escaping backtick in shell through python

I have a python script (a.py) that calls a shell script(b.sh). b.sh is responsible for updating a conf file through sed.Here is a sample call.b.sh -s hellowill save hello in the conf file via an sed...

View Article


Image may be NSFW.
Clik here to view.

Download a PDF using Selenium in Python

I'm trying to download the following PDF from a browser's PDF viewer by clicking the download button.I tried the following code using ID, CSS_SELECTOR, and XPATH locators, but it seems not to be...

View Article

How to change date format in pydantic

How to change date format in pydantic for validation and serialization?For validation I am using @validator. Is there an solution for both cases?

View Article

standard_init_linux.go:178: exec user process caused "exec format error"

docker started throwing this error:standard_init_linux.go:178: exec user process caused "exec format error"whenever I run a specific docker container with CMD or ENTRYPOINT, with no regard to any...

View Article


Django Python - How to Query this

I have this Consumer modelclass ConsumerModel(models.Model): GENDER_LIST = ( ('male','MALE'), ('female','FEMALE'), ("lgbt",'LGBT') ) REGISTER_AS = ( ('consumer','CONSUMER'), ('manager','MANAGER') ) uid...

View Article

Diagram Library - how to provide additional resource information

I am using Diagrams library for diagram generation. I have a .txt file that contains resource details (EC2, S3) including IP address, region, etc. I have created a logic in the python script that read...

View Article

convert dataframe from florida EDT to the California timezone

A database in Florida stores data from California in Florida day light saving time. Now, I want to convert it to the California time.Code:import pandas as pdfrom pytz import timezonefrom datetime...

View Article


How can I see the entire HTTP request that's being sent by my Python...

In my case, I'm using the requests library to call PayPal's API over HTTPS. Unfortunately, I'm getting an error from PayPal, and PayPal support cannot figure out what the error is or what's causing it....

View Article


How to clone last frame when using overlay in ffmpeg?

I use this code to slide previous and next pages up, this is no problems, can I remove png file 1970~1979-last.png and use the last frame of video file 1970~1979.mp4 to instead...

View Article

Using Subquery to annotate a Count

Please help me I've been stuck on this for way too long :( What I want to do:I have these two models:class Specialization(models.Model): name = models.CharField("name", max_length=64)class...

View Article

How do i integrate python script in a react-native app targeted for android

Guidance needed. I have a Python script that uses MediaPipe and OpenCV modules to map a 2D image of clothing on the person's body based on the extracted coordinates. This is done in real-time (tested...

View Article

Adaptive server connection failed (DB-Lib error message 20002, severity 9)

I'm sure this issue has been raised an uncountable number of times before but perhaps, someone could still help me.I am using pymssql v2.1.3 with Python 2.7.12 and the code that I used several times...

View Article


Pyside2 second window(QDialog) closes the main one

import sysfrom PySide2.QtCore import QFilefrom PySide2.QtWidgets import QApplication, QMainWindowfrom PySide2.QtUiTools import QUiLoaderclass MyMainWindow(QMainWindow): def __init__(self):...

View Article

In python, how can/should decorators be used to implement function polymorphism?

Supposing we have a class as follows:class PersonalChef(): def cook(): print("cooking something...")And we want what it cooks to be a function of the time of day, we could do something like this:class...

View Article


Pipeline for ML model using LabelEncoding in a Transformer

I'm attempting to incorporate various transformations into a scikit-learn pipeline along with a LightGBM model. This model aims to predict the prices of second-hand vehicles. Once trained, I plan to...

View Article

Formatting a number with a metric prefix (SI style)

I'm looking for an existing solution, for converting a number with a metric suffix (SI style) to float or int.Additionally, my initial number with a metric suffix is a string.Example:I have:a = "1u"b =...

View Article


Using a java library from python

I have a python app and java app. The python app generates input for the java app and invokes it on the command line.I'm sure there must be a more elegant solution to this; just like using JNI to...

View Article

Retrieving XMP metadata from PDF files with Python xmptools

I would like to use Python to retrieve metadata stored in PDF files. I am trying to use Python xmptools, but find that I cannot extract all the metadata. For example, this paper is available in PDF...

View Article

Python code to connect to FTP /convert my code in way that it uses FTP...

please help to write code to connect ftp using python download fresh files from specfic directory load those file in Mysql database ,mark them processed after downloading file from ftp ,after loading...

View Article
Browsing all 23218 articles
Browse latest View live