Python Questions
Ad
Making the printf function of C into Python
I wanna make a "hello, (name)." function in python by trying to make the c printf function. i want to turn it from
Calling Python functions in C program
I would like to call a python function to realize the encryption in sha256 from a c program. can someone help me in this work? or can someone give
How to send python dict to C++
this is my python function: if __name__ == "__main__": file = open("data_input.txt",
C Python.h API ImportError with OpenSSL
I am trying out the python api (python3) for c by making a hashing example using openssl and md5 but i am getting an error when attempting to
How do you wrap a C function that returns a pointer to a malloc'd array with ctypes?
I have a c function that reads a binary file and returns a dynamically sized array of unsigned integers (the size is based off metadata from the
Mock a token for flask unit tests - firebase-admin-python SDK
I am using the firebase-admin-python sdk to handle authentication between an ios app and a flask backend (python). this is my backend
ffmpeg burned-in subtitles render in the wrong font
Trying to burn in subtitles to a video in ffmpeg in gothamprobold font. no matter what i do it keeps reverting to helvetica. from the console, i
Python.h is in PATH but still not found
I am creating a python module using c, though when i use #include <python.h> it says that it find this file, even though i have
Issues building pywinhook from source
Python interpreter: 3.7 python library: pywinhook
How to get the number of active threads started by specific class?
Code looks like below: class workers1(thread): def __init__(self): thread.__init__(self) def run(self): #
Ad
How to get the number of args of a built-in function in Python?
I need to programmatically get the number of arguments that a function requires. with functions declared in modules this is trivial:
Why performance decreases when I call a C functions in Python?
I am using a random number generator as is suggested by
Axios GET request working on my local build but failing on Heroku - Uncaught (in promise) Error: Request failed with status code 500
I'm building an application using django/python backend and react/javascript frontend. the application is using axios to import data from another
Why does sys.exit(4294967295) set %ERRORLEVEL% to -1?
Stumbled upon this when messing around with a batch script that invokes a python script. in the python script, i was calling
Can create a website written in python using firebase hosting/database
I just started web development, but i have an app that uses firebase database, so i was wondering if i'd be able to create a website written in
How can I get a key from the value in Firebase?
My firebase structure is as below. i'm using python to use firebase, and also i use pyrebase. i want to get a key, which looks like
Is it possible to include c code in python in pycharm?
I'm trying to speed up some code that i have written in python and have thought about writing some code in c to do so. however, i am using pycharm
Waf configure error, cannot find pyembed for some reason
I'm trying to configure planck likelihood code using ./waf, but i keep getting the following error after calling ./waf configure cc=gcc
How do I change the appearance of the address bar and tab in Chromium to be similar to the attached image
The top image is compiled chromium and the bottom one is a design i made
Firebase cloud functions using Python?
We are using gcp's firebase with firestore for a new mobile app we are developing. as part of this effort we need to deploy a number of cloud
How to decode [email\xa0protected] while web scraping using python
When i am trying to extract mail id from the below tag using python lxml.html it is showing [email\xa0protected], any one help me to decode
Ad
PIL: Convert RGB image to a specific 8-bit palette?
Using the python imaging library, i can call img.convert("p", palette=image.adaptive) or
Find images with similar color palette with Python
Suppose there are 10,000 jpeg, png images in a gallery, how to find all images with similar color palettes to a selected image sorted by
Is there a way to build a Python module written in C with Windows OS?
I found several solutions, but all of them imply working on other oss, like linux. some say there is no way to build such module with
How to extract text from doc file?
How to extract text from doc file using c language? i need free library, with simple function like char* doc2txt(const char*)
How do I resolve this make fatal error: numpy/arrayobject.h: No such file or directory?
I have the following snippet in my makefile (the first line was added by me after finding it as a candidate solution online -
Is there a way to serverlessly update a big aggregated table daily?
I am trying to build a big aggregated table with googles tools but i am a bit lost on the 'how to do it'. here is what i would like to
MySQL-db lib for Python 3.x?
So, looking for a mysql-db-lib that is compatible with py3k/py3.0/py3000, any ideas? google turned up nothing.
python name a file same as a lib
I have the following script import getopt, sys opts, args = getopt.getopt(sys.argv[1:], "h:s") for key,value in opts: print
Template Lib (Engine) in Python running with Jython
Im searching a template lib or template engine for generating html (xml) that runs under jython (jython 2.5 alpha is ok).
How to split a string into a list, taking negative numbers into account?
I want to split a string like: strg = "22+11-aa+bb-44-" into a list like this: my_list = ['22',
Is there a common way to check in Python if an object is any function type?
I have a function in python which is iterating over the attributes returned from dir(obj), and i want to check to see if any of the
Ad
TypeError: 'Aircraft' object is not callable
I am working on a python tutorial and i keep running into a typeerror: 'aircraft' object is not callable this is the entire error
how to set a menubar icon on mac osx using wx
I could not find any pointers on how to create a menubar icon on osx using wx. i originally thought that the wxtaskbaricon class would do, but it
How do you load an embedded icon from an exe file with PyWin32?
I have an exe file generated with py2exe. in the setup.py i specify an icon to be embedded in the exe: windows=[{'script':
Web-Based Music Library (programming concept)
So, i've been tossing this idea around in my head for a while now. at its core, it's mostly a project for me to learn programming. the idea is
How to transform your Tinder data.json into a CSV
Tinder allows you to export your data (https://account.gotinder.com/data), which
Not able to dump data.Json serializable issue
Import json newdic={"name":"john","age":30,"cars": [{ "name":"ford", "models":["fiesta", "focus", "mustang" ] },{ "name":"bmw",
Render image in template.html with Jinja2 and weasyprint in a PDF
I have a python file that generates an html page (and a pdf) using jinja2 like this. import
Django {% extend static "template.html" %} throwing TemplateSyntaxError
I have a template.html file full of some boiler plate html text. then in index.html i have:
Passing data between veiws.py and template.html in django
I am new in django. i want to write a very simple code to create a string in views.py and shows in an html file in templates.: views.py
How to call a function in views.py on clicking a button in template.html in django
I have a form in which there is a button . i want to call a view function named def recognize(): in my views.py but after clicking
Django Key Error: KeyError at 'template.html' request when initiating a form
I'm working with pinax-stripe library, and i want to create a custom account for the logged in user.
Ad
Embed "Bokeh created html file" into Flask "template.html" file
I have a web application written in python - flask. when the user fill out some settings in one of the pages (post request), my controller
How to pass uploaded image to template.html in Flask
I am using flask, and trying to do something very simple using the quickstart tutorial,
Upload files in Google App Engine
I am planning to create a web app that allows users to downgrade their visual studio project files. however, it seems google app engine accepts
What's the easiest non-memory intensive way to output XML from Python?
Basically, something similar to system.xml.xmlwriter - a streaming xml writer that doesn't incur much of a memory overhead. so that rules out
How can I create a status bar item with Cocoa and Python (PyObjC)?
I have created a brand new project in xcode and have the following in my appdelegate.py file: from foundation import * from appkit
Trailing slashes in Pylons Routes
What is the best way to make trailing slashes not matter in the latest version of routes (1.10)? i currently am using the clearly non-dry:
How do I know if a generator is empty from the start?
Is there a simple way of testing if the generator has no items, like peek, hasnext, isempty, something
How do I add a custom inline admin widget in Django?
This is easy for non-inlines. just override the following in the your admin.py adminoptions: def formfield_for_dbfield(self,
Can you change a field label in the Django Admin application?
As the title suggests. i want to be able to change the label of a single field in the admin application. i'm aware of the form.field attribute,
Django FormWizard and Admin application
I have a series of forms that i need a user to complete in sequence, which is perfect for the formwizard app. however, i've some need of the admin
Django Admin Interface Does Not Use Subclass's __unicode__()
(django 1.x, python 2.6.x) i have models to the tune of: class animal(models.model): pass class cat(animal): def
Ad
Admin generic inlines for multi-table subclassed models broken --- any alternatives?
Here's what i'm trying to do, and failing... i have a file model which has a generic-relation to other objects: class
Why won't Django 1.0 admin application work?
I've just started playing with django and am loosely following the tutorial with my own set of basic requirements. the models i've sketched out so
In the Django admin interface, is there a way to duplicate an item?
Just wondering if there is an easy way to add the functionality to duplicate an existing listing in the admin interface? in data entry we
Keeping filters in Django Admin
What i would like to achive is: i go to admin site, apply some filters to the list of objects i click and object edit,
Django admin site not displaying ManyToManyField relationship
I'm working on what i think is a pretty standard django site, but am having trouble getting my admin section to display the proper fields.
Is there a way to define which fields in the model are editable in the admin app?
Assume the following: models.py class entry(models.model): title = models.charfield(max_length=50) slug =
Embedding Python in C Application
From the official docs ; #define py_ssize_t_clean #include <python.h> int main(int argc, char *argv[]) { wchar_t *program =
using gdb python api, how to fetch the value of a c variable during debug session
I am new to gdb python api. but i am not sure how can i get the get the value of a particular variable during the debug session
How to process video that is being streamed to a Firebase signaling server in Python
I have managed to setup my webcam to point to a specific location on the firebase database and broadcast a video using webrtc. i do this
How to expose Gmail API credentials.json to env
I am writing a gmail data query project in python using google gmail api library and i am using the gmail api credentials.json file. how
Errno 2 No such file or directory: 'credentials.json'
Python 3.6 still in the process of learning python, using this code from a public source but running into this issue: " [errno 2]
Ad
Using Google API for Python- no option to download credentials.json file?
I'm trying to use the google calendar api
Hand-Translating a C program to Python - grave errors
Something is amiss. this program calculates the number of primes until a number given by a user and times how long it took to perform the
How to Convert XLSX to Sheets in Google Drive API v3
I want to convert xlsx files automatically to google spreadsheets when i upload them with my code to google drive. however, while the conversion
What is the best way to sample/profile a PyObjC application?
Sampling with activity monitor/instruments/shark will show stack traces full of c functions for the python interpreter. i would be helpful to see
How do I expose a C variable to Python as a variable?
Suppose in a custom python module written in c, i declare the variable: static int module_state; the functions in
Current standard compliance level of IronPython & IronRuby
Does anyone have some numbers on this? i am just looking for a percentage, a summary will be better. standards compliance: how does the
How to transpile python Compare ast nodes to c?
Let's start by considering python3.8.5's grammar, in
How do I efficiently filter computed values within a Python list comprehension?
The python list comprehension syntax makes it easy to filter values within a comprehension. for example: result = [x**2 for x in
Best online resource to learn Python?
I am new to any scripting language. but, still i worked on scripting a bit like tailoring other scripts to work for my purpose. for me, what is
How to show the output of 'l' in python pdb after every command entered
I would like to have the output of the python pdb 'l' command printed to the screen after every command i enter in an interactive debugging
How can i get a list of all special methods available?
Special methods are for example (in django): def __wrapper__ def __deepcopy__ def __mod__ def __cmp__
Ad
How can I get a list of all classes within current module in Python?
I've seen plenty of examples of people extracting all of the classes from a module, usually something like: # foo.py class foo:
How can I get a list of the running applications with GTK?
How can i get a list of the running applications? i'm referring to the ones in the panel at the bottom of the screen.
How to add mobile collapsing navarro to django using materialize css?
I have some problems adding a navbar that collapses into a ‘hamburger bar’ at mobile devices and when a device is in split view. this is what
Python Authentication API
I'm looking for a python library that will help me to create an authentication method for a desktop app i'm writing. i have found several method
Amazon API library for Python?
What python libraries do folks use for querying amazon product data? (amazon associates web service - used to be called e-commerce api, or
Python - Doing absolute imports from a subfolder
Basically i'm asking the same question as this guy: how
Supporting python 2 and 3: str, bytes or alternative
I have a python2 codebase that makes extensive use of str to store raw binary data. i want to support both python2 and python3.
Python requests cannot resolve Docker-Compose services
I have 2 docker-compose set ups in separate repos. when i run them i want them to talk to each other on the same
can't connect to mysql docker-compose
I can't connect my docker app to my mysql server. but i can connect the app to the server from my local machine. i use
Fastest way to check if a list of sets has any containment relationship
I hava a list of 10,000 random sets with different lengths: import random random.seed(99) lst = [set(random.sample(range(1,
fastest way to access dataframe cell by colums values?
I have the following dataframe : time bk1_lvl0_id bk2_lvl0_id pr_ss order_upto_level initial_inventory leadtime1 leadtime2
Ad
Fastest way to discriminate values in JSON by a nested value for large JSON files
I have a json file (the largest file available here, 13.2 gb).
Fastest way to get dot product of a matrix and each point in the given array
I have an array nx3 of n points, each one has x, y and z coordinate. i need to rotate each point, so i have the rotation matrix 3x3. to do this, i
Fastest way to iterate over multiple lists
I'm trying to get 2 giant text files to combine their data into one text file. one text file containing 200 000 - 500 000 lines of
What is the Fastest way to compare values across columns in pandas (Python)
I have the following dataframe: import numpy as np import pandas as pd df = pd.dataframe(np.array([[1, 1, 1, 1], [1, 1, np.nan,
Fastest Way to Iterate Over Dataframe Column to Find Match in Strings
Here's a very truncated extract from a large dataframe: name
Fastest way to convert huge dictionary to a dataframe
I have a dictionary that looks like this: dict = {a: {a: 0, b: 1, c: 1, d: 2, e: 2, f: 2, g: 2, h: 2, i: 3}, b:
Fastest way to find 4-connected regions
I have a 2d numpy array filled with values in range [0,1] and i want to loop on the 4-connected region where value < 0.2. in order
Theoretical - Fastest way to compute different counts
I would like to know how experienced sql users would compute a lot of counts with different conditions. i have a table [population] and a table
Which is the fastest way of querying strings in python
Assume you have to query the prices of like 100 items (in the example i will query just 2) that are unique, which would be the fastest (measured
Fastest Way to convert a Binary String to Binary Array (Array of 1 and 0)
I am trying to find the fastest possible way to convert a binary string to an array of integer 0 and 1.
dropbox api - token expired ( fastest way to refresh )
I've generated the access token manually over the dropbox app console on their webpage.
Ad
Fastest way to count frequencies of ordered list entries
I'm counting the occurrences of non-overlapping grouped subsequences of length i in a binary list, so for example if i have a
What is the fastest way to retrieve header names from excel files using pandas
I have a big size excel files that i'm organizing the column names into a unique list. the code below works, but it takes ~9 minutes! does anyone
Ad
Blog Categories
Ad