text stringlengths 226 34.5k |
|---|
Hook to perform actions after loaddata command (loading fixtures)
Question: There's `post_syncdb` signal to perform actions that can be done after syncdb.
Is there a similar hook to perform some actions after loading fixtures i.e.
after `python manage.py loaddata` command ?
I have a script that creates a new database,... |
How can I isolate a Python dictionary from a list for comparison?
Question: I have a Python function that takes as arguments a player's name and score and
determines whether this is the player's highest score. It does so by comparing
the arguments against a shelve object.
The shelve should only store the high score fo... |
How to authenticate by Access Token in code using python-social-auth
Question: I have a REST API and I need to authenticate users via Facebook Login API.
Access Token should be obtained in mobile app (I guess) and then sent to the
server. So I have found some code in old tutorial and I can't make it work.
Here's the co... |
Send a packet of data literally via UDP in Python
Question: I want to my UDP data packet to have literately this information for example:
data = "83053163021478010102010370020000000000"
I'm using the follow code to send it which works fine(I can see it going out
on wireshark):
listen... |
Calling a C library module with ctypes gives false results
Question: I created a simple C library file to test how I can access C functions with
ctypes.
The function in the C file named tetr.c reads:
double square(double x){
return x*x;
}
So it returns the square of the number.
I've c... |
Python Custom Exception Handling
Question: After much googli searching to figure out whats going on, here it is:
I have a custom validation exception which takes a request and response
class ValidationException(Exception):
message = "Caught Validation Exception"
def __init__(self, r... |
Python 2.7 accessibility for blind
Question: Hello I am planning on creating a program in Python 2.7 using a tkinter GUI. I
am looking for some guidance on the best method to play text as audio in order
to aid people with visual difficulties.
The text that will need to be played would be text on buttons and text withi... |
Change cwd before running tests
Question: I have a bunch of `unittest` test cases in separate directories. There is also
a directory which just contains helper scripts for the tests. So my file tree
looks like this
test_dir1
test_dir2
test_dir3
helper_scripts
Each python file in `test_d... |
Get all possible combinations of rows in a matrix
Question: I'm setting up a simple sentence generator in python, to create as many word
combinations as possible to describe a generic set of images involving robots.
(Its a long story :D)
It outputs something like this: **'Cyborg Concept Downloadable Illustration'**
A... |
How can I stream a GET request line-by-line?
Question: I would like to send a GET request to a server that is streamed almost in
'realtime' using Chunk Transfer Encoding that I can completley modify line-by-
line. For example:
SendChunks = SomeHTTPLibrary.SendData;
SendChunks(Example.org, "5\r\n")
... |
Python- TypeError object int is not iterable
Question: Here is my code, when I am running it I get error on line 19 (for loop):
TypeError: object 'int' is not iterable.
import fb
from facepy import GraphAPI
token=""# access token here.
facebook=fb.graph.api(token)
graph1 = G... |
How to draw line segment on FITS figure using APLpy or python 2.7?
Question: I want to draw a line segment joining two points on a FITS figure.
(x,y) co-ordinates of these points are (200,250) & (300,400).
I am using APLpy for this.
My code is:
import matplotlib.pyplot as plt
import aplpy
impo... |
Django Python PIL save image - broken image
Question: I am overriding the `save_model` method of modelAdmin to resize the image to
650 which is being uploaded via admin page:
def save_model(self, request, obj, form, change):
basewidth = 650
img = PIL.Image.open(form.cleaned_data['image_fi... |
Avoid click to get out of wxPython TreeCtrl in a Notebook
Question: Below is a very simple wxPython code creating a Notebook inside which are
several panels containing TreeCtrl objects.
Using it, I get a behavior I would like to avoid:
When I click in a tree, then I cannot switch directly to another page of the
noteb... |
PHP UTF8 decode not working for out returned from python
Question: i get a reply from python server basically what i am doing is sending an
article and the python code is sending me important tags in the article. the
reply i get is like this
"keywords": "[u'Smartphone', u'Abmessung', u'Geh\xe4userand']"
... |
python-mplayer not opening mp3 file
Question: Hi Iam trying to build a small audio player, integrating mplayer into python
I thought python-mplayer could do the job but I cannot get it to work. Any
idea?
seems like p.loadfile doesnt work as ps ax shows /usr/bin/mplayer -slave -idle
-really-quiet -msglevel global=4 -i... |
error when try to install flask in the virtual enviroment
Question: I just configure the environment to develop the flask based web app. All the
things goes smoothly, but when I run my hello world app, the python interpret
tell me no module named flask:
Traceback (most recent call last):
File "hell... |
how to scrape imbeded script on webpage in python
Question: For example, I have webpage
[http://www.amazon.com/dp/1597805483](http://rads.stackoverflow.com/amzn/click/1597805483).
I want to use xpath to scrape this sentence `Of all the sports played across
the globe, none has more curses and superstitions than basebal... |
Why does sys.getsizeof() not return [size] in file.read([size]) in Python
Question: I have a large binary file that I would like to read in and unpack using
struct.unpack() The file consists of a number of lines each 2957 bytes long. I
read in the file using the following code:
with open("bin_file", "rb"... |
Python - urllib2 > how to escape HTTP errors
Question: I am making a python app and I want to read a file from the net. this is the
code that I am using to read it :
urllib2.urlopen("http://example.com/check.txt").read()
everything works great but when I point it to a url that do not exist, it
give... |
Python Using Lists to create program
Question: I have an assignment in class to write a program using lists in Python
"Create a program that prompts the user for a vocabulary word. Then prompts
user to enter the word's definition. Ask user if they want to enter more words
and definitions. When they are done entering a... |
Does pygtk garbage-collect runtime-created functions connected to signals?
Question: I'm using PyGtk.
Will a **runtime-generated** function connected to the signal "drag_data_get"
of a widget be **garbage-collected** when the widget is **destroyed** ?
Same question about the Gtk.TargetList that are created and associ... |
Can't install SciPy on production server
Question: I'm trying to install SciPy on a Ubuntu machine in the cloud. Here are the
steps I followed:
* sudo pip install numpy
* sudo apt-get install gfortran
* sudo apt-get install libblas-dev
* sudo apt-get install liblapack-dev
* sudo apt-get install g++
* sudo ... |
Running python unittest in the console
Question: I have the follwoing package structure
my-base-project
-> package1
__init__.py
MyScript.py
-> test
__init__.py
TestMyScript.py
I'd like to run the `TestMyScript.py` in the console. Therefore I cd in to
`my-base... |
Writing generated numbers in text file in Python
Question: So I tried browsing other posts, and even asked a friend before resorting to
actually asking here. I have a homework assignment which calls for me to
create a program in Python, that generates random numbers based on how many
numbers a user inputs. For example,... |
Sympy cannot find the laplace transform of sinh (t)
Question: I have been using **sympy** for quite a few months now, and recently I have
run into a problem.
The following code is supposed to calculate the Laplace Transform of
**sinh(t)**.
from sympy import *
from sympy.abc import *
laplace_tran... |
Passing string rather than function in django url pattern
Question: In the [Django
docs](https://docs.djangoproject.com/en/1.7/topics/http/urls/#passing-strings-
instead-of-callable-objects) it says about url patterns:
> It is possible to pass a string containing the path to a view rather than
> the actual Python func... |
Python - NameError
Question: I have the following code that uses 3 strings 'us dollars','euro',
'02-11-2014', and a number to calculate the exchange rate for that given date.
I modified the code to pass those arguments but I get an error when I try to
call it with
python currencyManager.py "us dollars" "... |
I would like to check if an input is python code
Question: I would like to check if an input is code before joining it to a larger
variable to eventually execute, is there any way I can do this? For example:
import readline
while True:
codelines=[]
code=raw_input(">>> ")
if co... |
Cannot import MySQLdb - python - Windows 8.1
Question: I am trying to import MySQLdb in python. I checked and followed all possible
solutions but I am still not able to import it. I have Windows 8.1.
So I started fresh, I installed the latest version of python (2.7.8), set the
path and pythonpath variables, and then t... |
Python Pandas Data Formatting
Question: I am in some sort of Python Pandas datetime purgatory and cannot seem to
figure out why the below throws an error. I have a simple date, a clear format
string, and a thus far unexplained ValueError. I've done quite a bit of
searching, and can't seem to get to the bottom of this.
... |
How to convert Excel data into mysql without installing the plugin
Question: I have an Excel file which contains details about a database with 8 columns &
8000 rows.This data should be converted in to MySql. **I would like to use
python but not sure which library would support this conversion.** The file
which I have i... |
Mongo UUID python vs java format
Question: I have an application that sends requests to a restAPI, where a java process
stores the data in mongo. When I try to read this data back using pymongo,
reading the database directly, it gets the UUIDs differently (seems it is due
to different encoding in java/python).
Is ther... |
Inter-thread communication with python: Plotting memory-consumption using separate python thread
Question: Withing a python-script I call sequentially different functions (lets say
func_a, func_b, func_c), which process a given set of input data.
The execution takes about 30min.
Within these 30 minutes, I want to tra... |
Access USB device info with ctypes?
Question: I am using python with `ctypes` to somehow access information about a USB
device that is connected to the PC. Is this achievable from a .dll? I try to
find things like where it's mounted, its vendor, etc.
An example:
>>> import ctypes import windll
>>> w... |
Python cannot allocate memory using multiprocessing.pool
Question: My code (part of a genetic optimization algorithm) runs a few processes in
parallel, waits for all of them to finish, reads the output, and then repeats
with a different input. Everything was working fine when I tested with 60
repetitions. Since it work... |
OrderedDict won't sort within a class
Question: I have a parent class, and I want to keep a registry (in the form of a
dictionary) of all instances of its sub-classes. Easy, but I want the registry
to sort itself based on its keys, which are the arguments of the 2 sub-classes
on initialisation. This is my code in simpl... |
Get list of all possible dict configs in Python
Question: I have dict that describes possible config values, e.g.
{'a':[1,2], 'b':[3,4,5]}
I want to generate list of all acceptable configs, e.g.
[{'a':1, 'b':3},
{'a':1, 'b':4},
{'a':1, 'b':5},
{'a':2, 'b':3},
{'a... |
How do i generate secure session_id on python?
Question: I'm trying to generate a secure session_id on python 3.
First of all, i just generate md5 hash value of timestamp (included
microseconds) and then write the value via cookie. But this method could
hijackable. for example, extract session_id value from browser A'... |
What is the difference between spark-submit and pyspark?
Question: If I start up pyspark and then run this command:
import my_script; spark = my_script.Sparker(sc); spark.collapse('./data/')
Everything is A-ok. If, however, I try to do the same thing through the
commandline and spark-submit, I get ... |
python math.acos inverse cosine issues
Question: I need to find an angle of a triangle with only three coordinate points on a
plane. In regular trigonometry at the end of the equation i would use:
cos = (a ** 2) - (b ** 2) - (c ** 2) / -2 * b * c
I used the `**` operator for to the power of, and `s... |
Python Find all letter chars in string and surround with text
Question: So lets say I have a string that says "m * x + b", I want to find any letter
chars, other than x, and surround them with text.
In this example, output should be "var['m'] * x + var['b']"
Answer: A tiny regular expression solves your problem:
... |
os.command giving Attribute error
Question: Hi I am trying to rum a C *.o using python 2.6.5 as follows
import os
import sys
file_type = os.command('./file_type.o %s.txt 2>&1' % file_name)
And, it gives the error message :
Traceback (most recent call last):
File "<stdin... |
Python SQlite3 syntax error - cant figure out whats wrong
Question: I have a variation of the code below which I've re-written several times and
get the same error. `OperationalError: near ".": syntax error` which I googled
and removed a primary key and checked that all field names started with a
lower case letter and ... |
IF and ELSE Exception in Python3
Question: I am trying to catch an exception for two boolean (for if and else
separately).
this is what I am working on:
from math import *
from decimal import Decimal
def add(self, *args):
try:
if all(isinstance(n, int) for n in args... |
How to avoid nested "with" statements when working with multiple files in Python
Question: When working with multiple files in Python code can get ugly when using the
recommended style:
with open("foo.txt") as foo:
with open("bar.txt", "w") as bar:
with open("baz.txt", "w") as baz:
... |
How to parse Date(928142400000+0200)?
Question: I have JSON response object with string representing date and time:
"event":{
"type":"Type",
"date-time":"\/Date(928142400000+0200)\/",
},
I am not sure:
* what format is that
* how can I parse it in python app
* how can I c... |
Why is the assert not getting imported here
Question: I have the following unit test case.
import unittest
from webPageTestUtils import WebPageTestProcessor
class webPageUtilsTest(unittest.TestCase):
def setUp(self):
self.webPageTestProcessor = WebPageTestProcessor()... |
Calling Cython C functions from Python
Question: I have a [`Cython`](http://cython.org/) file called `foo.pyx` containing the
following functions:
def add_one(int n):
cdef int m = n + 1
return m
cdef int c_add_one(int n):
return n + 1
I build this `pyx` file using `... |
python global parameters file
Question: I have a python script that calls multiple functions from other scripts. I
call the script giving it as a parameter a settings file with the format:
var1 = XXX
var2 = YYY
...
I would like to make those variables global so they can be used by every
fun... |
python termination error when ctypes dll calls printf
Question: I am developing a python system with some core dlls accessed via ctypes. I
have reduced the problem to this condition: execute a module that loads (no
need to call) two dlls, one of which calls printf -- this error will occur in
exit.
> This application h... |
What is wrong with my python code?
Question: I'm trying to make a guessing game in python.
from random import randint
print "\nI'm thinking of a number, you have to guess what it is.\n"
num = randint(1,100)
guess = 0
while guess != num:
guess = raw_input("Guess the numbe... |
Offset key WORD for cipher in Python
Question: So I am half way through a Computing GCSE controlled assessment at school.
I have completed task one of my controlled assessment which was to create a
Caeser Cipher which encrypts a message by offsetting each letter in the
message by a key number which the user must enter... |
Python ctypes identifying dll function result
Question: I have some functions according to a DLL's documentation (there are more):
# there are 2 lines in the other example like this
# define CALLTYPE __stdcall
# define pLSenvL void*
pLSenvL CALLTYPE LScreateEnvL()
int LSopenLogFileL(... |
Server side execution (execution back-end image processing )
Question: I tried to build an web app with python django module. The task is If any one
go to the link it will process image with threshold and save to server folder.
My code is(views.py):-
from django.http import HttpResponse
import numpy... |
How to run f2py in macosx
Question: Hi I am trying to use f2py in macosx.
I have a homebrew python instalation and I have installed numpy using pip.
If I write on terminal `f2py` I get `-bash: f2py: command not found` but if I
write in a python script `import numpy.f2py`it works well. How can I solve
this problem r... |
Precarious Popen Piping
Question: I want to use `subprocess.Popen` to run a process, with the following
requirements.
1. I want to pipe the `stdout` and `stderr` back to the caller of `Popen` as the process runs.
2. I want to kill the process after `timeout` seconds if it is still running.
I have come to the con... |
Python - Calling lines from a text file to compile a pattern search of a second file
Question: Forgive me if this is asked and answered. If so, chalk it up to my being new
to programming and not knowing enough to search properly.
I have a need to read in a file containing a series of several hundred
phrases, such as n... |
Debugging issues in importing modules in Python
Question: Does importing a specific function from a module is a faster process than
importing the whole module?
That is, is **from module import x** debugs faster than **import module**?
Answer: No, it shouldn't be faster, and that shouldn't matter anyway: importing th... |
Command 'makemessages' error
Question: I newbe in django and python. My project created under PyTools for Visual
Studio 2013. For localization I create 'locale' folder on manage.py level. And
I try run the following command:
.\ClarisPyEnv\Scripts\python.exe manage.py makemessages -l he
And I got the error:
... |
Treebank-style tree parser python
Question: Recently i have been trying to parse syntactic trees returned by the [stanford
parser](http://nlp.stanford.edu/software/lex-parser.shtml) in python. I have
been trying to do that with nltk `tree =
Tree.parse(result['sentences'][0]['parsetree'])` and the parsing succeeds but
t... |
To unzip a file
Question: I want to unzip a file of type *.sec.gz which is a zipfile. But i'm getting
badfile.....Can someone guide to resolve this.....File present in the folder
is of type *.sec ........Thanks in advance
import zipfile
def unzip(path):
zfile = zipfile.ZipFile(path)
f... |
Opening multiple excel files using Python
Question: I have multiple excel files in a directory and would like to open those files
at a time to perform write operations (To, for example, write "Hi" in the
first row of all the excel files). Is there any way to do so in Python?
Answer: You can use:
import... |
How to script django shell operations?
Question: I'd like to create a script (.sh or python, not important) that can do the
following:
heroku pg:reset DATABASE_URL
heroku run python manage.py migrate
heroku run python manage.py shell
> from myapp.scenarios import *; reset_demo_data(); exit()
... |
python input() not working! (raspberry pi camera program)
Question: I am on my raspberry pi making a camera program (code)
import picamera
import sys
import time
question=input('do you want to take a picture(pic) take a timed picture(time) or a video(vid)')
if question=='pic':
... |
python urllib2 and unicode
Question: I would like to collect information from the results given by a search engine.
But I can only write text instead of unicode in the query part.
import urllib2
a = "바둑"
a = a.decode("utf-8")
type(a)
#Out[35]: unicode
url = "http://search.naver.c... |
Python how to delete lowercase words from a string that is in a list
Question: My question is: how do I delete all the lowercase words from a string that is
an element in a list? For example, if I have this list: `s = ["Johnny and
Annie.", "She and I."]`
what do I have to write to make python return `newlist = ["Johnn... |
MapReduce is not sorting
Question: I'm using python to develop a mapreduce program, when I use map.py and
reduce.py by comand line:
cat passengers.dat | python map.py | sort | python reduce.py
The result is good. But if I try to use mapreduce:
hadoop jar /usr/lib/hadoop-mapreduce/had... |
Best strategy for merging a lot of data frames using pandas
Question: I'm trying to merge many (a few thousand one column tsv files) data frames
into a single csv file using pandas. I'm new to pandas (and python for that
matter) and could use some input or direction.
My data frames are observational data on a list scr... |
importing with * (asterisk) versus as a namespace in python
Question: I know that its bad form to use `import *` in python, and I don't plan to make
a habit of it. However I recently came across some curious behaviour that I
don't understand, and wondered if someone could explain it to me.
Lets say I have three python... |
Python Minimising function with Nelder-Mead algorithm
Question: I'm trying to minimize a function `mymodel` with the Nelder-Mead algorithm to
fit my data. This is done in the `myfit` function with scipy's
`optimize.fmin`. I think I'm quite close, but I must be missing something,
because I keep getting an error:
'opera... |
Python - Text in form disappears
Question: In the following code below, I would like to text to stay in the form when the
submit button is pressed. Currently the text disappears when submit is
pressed.
Here is a tutorial link I've been following:
<https://www.udacity.com/course/viewer#!/c-cs253/l-48736183/e-48754026/m... |
Python-selecting specified items from dictionary list
Question: Let's say I have list of cars:
car=[{'model':'ferrari', 'color': 'red', 'price':1200},
{'model':'lamborgini', 'color': 'blue', 'price':2000},
{'model':'ferrari', 'color': 'yellow', 'price':1000},
{'model':'ferrari', 'color': 'yel... |
Python solving 2nd order ODE with quad function
Question: I am studying the dynamics of a damped, driven pendulum with second order ODE
defined like
[so](http://www.cmp.caltech.edu/~mcc/Chaos_Course/Lesson2/Demos.html), and
specifically I am progamming:
d^2y/dt^2 + c * dy/dt + sin(y) = a * cos(wt)
impor... |
Python module manipulation with other modules
Question: I was fooling around with python modules today and i found something
interesting; Suppose you have a module like this:
# mymodule
value = "default"
def setVal(new):
value = new
def getVal():
return value
... |
VIM/Python: visualmode/mode detection
Question:
function! Delete() range
python3 << EOF
import vim
vim.command('let x = visualmode()')
mode = vim.eval('x')
EOF
endfunction
I'm not able to detect 'mode' properly in vim (xterm). It can't switch between
'visual' 'normal' - i ge... |
How to read & export certain files from a Python GUI-prompted directory?
Question: OK guys,
I'm currently working on a file reading and processing with Python & OpenCV
cs' GUI feature. The feature will prompt the user to select a directory path
for a folder containing 340 JPEG images, which I labelled them as "frame1"... |
Comparing 2 images/pictures, and mark the difference
Question: I am learning to compare 2 images/pictures. I found the post [Compare two
images the python/linux
way](http://stackoverflow.com/questions/1927660/compare-two-images-the-python-
linux-way) is very useful but I have 2 questions regarding the technique. So
ple... |
How to customize a folder's icon via Python?
Question: As [this SU answer](http://superuser.com/a/410091/35237) notes, in order to
change a folder's icon, one has to change a folder's attribute to read-only or
system, and have its `desktop.ini` contain something like
[.ShellClassInfo]
IconResource=so... |
Maptlotlib: add zoomed region of a graph with anisotropic (axis dependent) zoom
Question: I'm trying to get a plot done using `Python.matplotlib` in which I would add
to a first plot a zoomed region in a box located in the lower right corner.
Looking at documentation and examples, I know that this is usually done usin... |
connected components attributes in python
Question: I want to compute statistics on the connected components of a binary image. In
matlab we have
> Shape Measurements
'Area' 'EulerNumber' 'Orientation'
'BoundingBox' 'Extent' 'Perimeter' ... |
python 2.7 requests.get() returning cookie raising TypeError
Question: I'm doing a simple HTTP requests authentication vs our internal server,
getting the cookie back then hitting a Cassandra RESTful server to get data.
The requests.get() chokes when returning the cookie.
I have a curl script that extracts the data su... |
Writing hex data into a file
Question: I'm trying to write hex data taken from ascii file to a newly created binary
file
ascii file example:
98 af b7 93 bb 03 bf 8e ae 16 bf 2e 52 43 8b df
4f 4e 5a e4 26 3f ca f7 b1 ab 93 4f 20 bf 0a bf
82 2c dd c5 38 70 17 a0 00 fd 3b fe 3d 53 fc 3b
28 c1 f... |
cannot instantiate a class even though it is in a module
Question: I want to use [`pycvss`](https://pypi.python.org/pypi/pycvss/1.0.2) so I
installed it via `pip`.
Instantiating the `Cvss()` class fails, though:
>>> import pycvss
>>> c = pycvss.Cvss()
Traceback (most recent call last):
Fil... |
Python exiting multiple threads
Question: I'm trying to see how multi thread are working in order to use them in an
automation project. I can run the thread but I cannot find a way to exit
completely the two threads: the thread restart after each keyboard interupt.
Is there a way to exit both thread with a keyboard int... |
Testing in Django 1.7 throws warning: RemovedInDjango18Warning
Question: When I do my tests with Django 1.7.1 it throws the next warning:
/usr/local/lib/python2.7/dist-packages/django/test/_doctest.py:59:
RemovedInDjango18Warning: The django.test._doctest module is deprecated;
use the doctest mod... |
Communicating with the outside world from within an atomic database transaction
Question: I am implementing an import tool (Django 1.6) that takes a potentially very
large CSV file, validates it and depending on user confirmation imports it or
not. Given the potential large filesize, the processing of the file is done
... |
Python: onkeypress without turtle window?
Question: My problem at this time is, that I want to detect a keypress through the
command
onkeypress(fun,"key")
but when I import onkeypress and listen from turtle, a turtle window pops out,
when I run my program. Do you know how to close it again, or how ... |
class ForkAwareLocal(threading.local): AttributeError: 'module' object has no attribute 'local
Question: I'm a python newbie. Am trying this code snippet from the manual, but am
getting this error. Cannot figure out why. Any help will be appreciated. Thx
## Abhi
## code snippet
#/usr/bin/python
# -... |
Replacing JSON value in python
Question: **EDIT: sorry, i had a hard to see uppercase/lowercase typo. please someone
delete this question.**
I am trying to change the value of a json object with simplejson. The problem
is that instead of replacing it, it is adding another entry with the same key.
{
... |
Python module function not defined
Question: I am trying to import a module in my python script and I can't make it work.
So I have my python script: /home/user/pythonscript/oneDir/onescript.py And I
would like to use a script that is a directory higher in hierarchy:
/home/user/pythonscript/common.py So I did the follo... |
All possible combinations of dictionary values given input string. Python
Question: I'm trying to get all possible strings from the values in a dictionary given a
particular key. For example, 'A' could mean either 'aaa','aba', or 'aac' and
'B' could mean either 'bbb','bab', or 'bbc', etc.
I've given an example of the ... |
updating djangocms database entry via script not working with cronjob
Question: I have a python script which automatically updates a database entry of the
`djangocms_text_ckeditor_text` table. I'm using djangocms 3 on debian wheezy.
When running this script from the bash with `trutty:~$ ./update.py` it works
and the da... |
Configuring OpenCV with Python on Mac, but failed to compile
Question: I was trying to configure the OpenCV with Python 2.7 on a MacOSX environment,
I use the Homebrew to install OpenCV, and it works perfect with C++, but when
I attempted to compile a python file by typing `python test.py`, it gives me
the error saying... |
Python Selenium to select "menuitem" from "menubar"
Question: I have a code that clicks a button on a web page, which pops up a `menubar`. I
would like to select a `menuitem` from the choices that appear, and then
`click` the `menuitem` (if possible); however, I'm at a roadblock.
Here is the relevant part of the code ... |
Insert the $currentDate on mongodb with pymongo
Question: I need test the accuracy of a server mongodb. I am trying to insert a sequence
of data, take the moment and it was sent to the database to know when it was
inserted. I'm trying this:
#!/usr/bin/python
from pymongo import Connection
from da... |
Append to XML structure in python
Question: I would like to change/add a custom subelement to an xml which was generated
by my script.
The top element is AAA:
top = Element('AAA')
The collected_lines looks like this:
[['TY', ' RPRT'], ['A1', ' Peter'], ['T3', ' Something'], ['ER', '... |
Running Flask app on Heroku
Question: I'm trying to run a Flask app on Heroku and I'm getting some frustrating
results. I'm not interested in the ops side of things. I just want to upload
my code and have it run. Pushing to the Heroku git remote works fine (`git
push heroku master`), but when I tail the logs (`heroku l... |
Create a one week agenda in python
Question: I'm starting studying python and in particular I'm starting studying the
dictionary. I saw an exercise and I decide to solve it. The exercise asks to
create a one week agenda in python using dictionaries. Nothing too complicate
but I have also to insert the appointment that ... |
"TypeError: Can't convert 'NoneType' object to str implicitly" when var should have a value
Question:
import sys
from tkinter import *
def print():
print("Encoded " + message + " with " + offset)
gui = Tk()
gui.title("Caesar Cypher Encoder")
Button(gui, text="Encode", com... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.