text stringlengths 226 34.5k |
|---|
python django soaplib response with classmodel issue
Question: I run a soap server in django.
Is it possible to create a soap method that returns a soaplib classmodel
instance without <{method name}Response><{method name}Result> tags?
For example, here is a part of my soap server code:
# -*- coding: cp... |
regex does not work if I read a string from a file
Question: I have a file named `foo` with the following text
<ca>
-----BEGIN CERTIFICATE-----
MIIB6DCCAVECBCMBFpQwDQYJKoZIhvcNAQEFBQAwOzEPMA0GA1UEAxMGbGZ0Lmpw
MRswGQYDVQQKExJ1N2FoMzZpN24wYSBsejFpZzUxCzAJBgNVBAYTAlVTMB4XDTEz
MTIwNzE5MjkxNVo... |
Set day, month and year of a python time_struct without changing the time
Question: How can I set day, month, and year of a python time_struct without changing
the time which is already in.
The time is specified by the user and assumed to be a time of the current day.
This code converts the given string to a time_stru... |
Flattening list in python
Question: I have seen many posts regarding how to flatten a list in Python. But I was
never able to understand how this is working: `reduce(lambda x,y:x+y,*myList)`
Could someone please explain, how this is working:
>>> myList = [[[1,2,3],[4,5],[6,7,8,9]]]
>>> reduce(lambda... |
TypeError: 'int' object is not callable In Python
Question: Bit of a python noob and I'm required to add a regular expression in my code
but can not get it to work :/ i have searched the error message on google and
tried to figure out whats wrong but no luck so i figured next best thing to do
would be to ask directly. ... |
Is there a way to enable autocompletion for PyQt5 with Eclipse Kepler and PyDev 2.8?
Question: it seems I can't find a way to enable autocompletion for PyQt5 in Eclipse
using PyDev 2.8. I'm running Mac OS 10.9 Mavericks.
While installing PyQt5 I noticed that there weren't '.py' modules installed in
the default library... |
When calling a function from a module can you say what is returned? (Python)
Question: It may sound a bit noobish but say i call a function from the module psutils,
is there a way to say which value i want back
for example:
psutil.swap_memory()
returns
swap(total=A, used=B, ... |
Python glmnet "No module named _glmnet"
Question: **UPDATE** Getting close. Now I'm running `f2py` on the `.pyf` file that
should generate the `_glmnet` module.
I build the package [python-glmnet](https://github.com/dwf/glmnet-python)
packet with the following command.
python setup.py config_fc --fcompi... |
matplotlib showing empty plot in Python
Question: I am using Python 2.7 and matplotlib to create a simple plot window on Ubuntu
12.10.
When `plt.plot()` is called, an empty windows comes up, but closes
instantaneously, without displaying any figure inside it, only a grey
background. However, if I try with `plt.savefig... |
lxml install on windows 7 using pip and python 2.7
Question: When I try to upgrade lxml using pip on my windows 7 machine I get the log
printed below.
When I uninstall and try to install from scratch I get the same errors. Any
ideas?
> Downloading/unpacking lxml from
> <https://pypi.python.org/packages/source/l/lxml/... |
Building an egg of my python project
Question: Can somebody please guide me with step-by-step procedure on how to eggfy my
existing python project? The documentation is keep mentioning something about
setup.py within a package but I cannot find it in my project...
thank you,
Answer: You can use [setuptools](https://... |
can not import the custome apps in django 1.6
Question: i am creating a simple project to test the environment, the project structrue
look like the following
root/
manage.py
mysite/
apps/
__init__.py
app1/
urls.py
... |
Recommendation for validating Python class data?
Question: I'm looking for recommendations for automated validation of instance variables
in Python objects. The validation should occur immediately upon instantiation
or setting.
For example, imagine a class like:
import recordtype
class TemperatureRe... |
How to add a library in python
Question: I am trying to authenticate `jawbone` api in python. In the code there is a
line:
import requests
How can I add this. I have very little knowledge on python. Just manipulating
the code. Can any one please help? The library is already present in python
3.3
... |
MTV newbie issues with Python Django
Question: I am kinda new with the MVC and MTV concept and i am trying to learn Python
Django. I want to make catalog with books, must have add and delete
functionality. I am trying to follow best practices and working with Generic
views, but kinda stuck at the end, i feel that i am ... |
split up classmethods in python
Question: I am often using classmethods instead of the default constructor in python for
example:
class Data(object):
def __init__(self, x, y, z):
self.x = x etc..
@classmethod
def from_xml(cls, xml_file):
x, y, z = imp... |
Can PyCharm's optimize imports also alphabetize them?
Question: I am enjoying PyCharm's optimizing of Python imports - as well as removing
unused imports, following PEP8 gives them a sensible layout and makes them
easier to read. Is there any way to get PyCharm to additionally alphabetize
them (which would make scannin... |
How to implement Circular Permutation (left and right shift) of CSR_Matrix in Scipy Python Sparse Matrices?
Question: I am using Scipy sparse matrix `csr_matrix` to be used as context vectors in
word-context vectors. My `csr_matrix` is a `(1, 300)` shape so it is a
1-dimensional vector.
I need to use permutation (circ... |
Deploying Flask app on EC2 for localhost access
Question: I have finished up a simple Flask app that I am trying to host on an AWS EC2
instance with Apache2. I've been following [this
tutorial](http://blog.garethdwyer.co.za/2013/07/getting-simple-flask-app-
running-on.html).
The only changes I've made from the develop... |
python ascii to unicode conversion
Question: i have a file with data like this:
\r\n\tSoci\u00e9t\u00e9 implant\u00e9 dans l'internet recrute des t\u00e9l\u00e9conseillers en b to b pour effectuer de la prise de rendez-vous qualifi\u00e9 pour de la conception de site internet et du r\u00e9f\u00e9rencemen... |
I'm getting slightly different hmac signatures out of clojure and python
Question: The HMAC SHA1 signatures I'm getting from my python implementation and my
clojure implementation are slightly different. I'm stumped as to what would
cause that.
Python implementation:
import hashlib
import hmac
... |
TypeError while representing arbitrary element type in multiprocessing.Array
Question:
>>> from multiprocessing import Array, Value
>>> import numpy as np
>>> a = [(i,[]) for i in range(3)]
>>> a
[(0, []), (1, []), (2, [])]
>>> a[0][1].extend(np.array([1,2,3]))
>>> a[1][1].extend(np.array([... |
Py2app: saving files on hard drive with easygui
Question: I usually save xls files created within Python scripts on my hard drive. That
's usually a pretty straight forward thing to do with pandas, for instance.
My problem is that I'm trying to accomplish this from a py2app-compiled
script. I tried using easygui to as... |
Is it necessarily safe to delete unused imports in borrowed code?
Question: I'm studying a demo script from the
[paramiko](https://github.com/paramiko/paramiko) package
([forward.py](https://github.com/paramiko/paramiko/blob/master/demos/forward.py))
to familiarize myself with SSH tunneling in Python. When I opened the... |
Move files from one directory to another if they appear in a text file in Python (take 2)
Question: Ok I'm going to try this again, apologies for my poor effort in my pervious
question.
I am writing a program in Java and I wanted to move some files from one
directory to another based on whether they appear in a list. ... |
How to create multiple sprites which are similar?
Question: Let me show you the code which may help make this question make more sense.
import pygame, classes, random
pygame.init()
screen = pygame.display.set_mode((640, 480))
def game():
pygame.display.set_caption("GOLOGO")
... |
parsing with libclang : getting CXX_BASE_SPECIFIER cursors when base types unknown
Question: I'm writing a **documentation generator** and getting the include paths right
is hell so **I just skip entirely every includes** when I parse a file. I also
tune by hands all problematic defines or #ifdef blocks that would get ... |
Django application override & import path?
Question: Let's have a django project using a 3rd party application. I'd like to
override some of its modules without touching original files. Simple
subclassing is not possible here, need to override code transparently as many
other apps rely on original class names and funct... |
Python compare bombs if files not sorted
Question: I have written some code to compare two files via a search string.
The file = master data file The checkfile = list of states & regions
When I have more than 1 state in the file that is not in sorted order it bombs
out.
How can i get this to work without having to s... |
String Compression: Output Alphabet Restricted to Alphanumeric Characters
Question: I have a long string and I would like to compress it to a new string with the
restriction that the **output** alphabet only contains `[a-z]` `[A-Z]` and
`[0-9]` characters.
How can I do this, specifically in Python?
Answer: While man... |
Python: literally "printing" a function
Question: For reasons I won't get into, I need some way to literally print a function.
I know when you run print on a function object you get some complicated
<010101045 function> output. So to my understanding perhaps the only way to do
this is run some kind of python notepad m... |
CSV file writing error. python
Question: I made code working previously pasted .
import serial
import csv
import os
import time
def main():
pass
if __name__ == '__main__':
main()
COUNT=0
ser=serial.Serial()
ser.port=2
ser.baudrate=96... |
how to store a SQL-database in a python object, and perform queries in the object?
Question: I have a big postgrSQL database. I would like to somehow store the full
database in a python object, which form/structure would reflect the one of the
database. Namely I imagine something like * An object database, with an
attr... |
Access a variable in imported module in Python
Question: I have three Python scripts: aaa.py, bbb.py and ccc.py.
bbb.py:
import aaa as a
ccc.py:
import bbb as b
Can I use variable `a` directly in ccc.py? Like `a.hello`?
Or can any one please tell me how to access it?
Answer... |
using threading in pygame
Question: I have a raspberry pi and on one of the gpio pins I am sending pulse, thus I
have python code to detect interrupt on that pin and their are at most 2
interrupts every seconds. Now I want to pass this value(total no. of
interrupts) to pygame application. Currently python code for dete... |
Authenticating via curl with Tasty Pie, using Session Authentication
Question: So, it seems that I can perform this action just fine from the browser, but I
can't seem to replicate it via CURL. Any pointers on how this is supposed to
work are greatly, greatly appreciated.
I perform this request to log in a user:
... |
how to get tbody from table from python beautiful soup ?
Question: I'm trying to scrap Year & Winners ( first & second columns ) from "List of
finals matches" table (second table) from
<http://en.wikipedia.org/wiki/List_of_FIFA_World_Cup_finals>: I'm using the
code below:
import urllib2
from Beautifu... |
Use python slice objects when reading HDF5 file with h5py?
Question: I am trying to use python slice objects to access data from an HDF5 file using
the `h5py` module. I put together this example to show that it works with
`numpy` arrays, but not with `h5py`.
import h5py
import numpy as np
sl... |
opencv: image with grid and HIGHGUI error
Question: Hi I'm new to opencv(version 2.4.7) and using it in python 2.7.4. I always get
this error
> HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
whenever I use the command
cam = cv2.VideoCapture(cam_id)
The code works fine otherwise even with the error. I'm t... |
Python - Generate a list of IP addresses from user input
Question: I am trying to create a script that generates a list of IP addresses based on
a users input for a start and end IP range. For example, they could enter
192.168.1.25 & 192.168.1.50. The list would then be fed into scapy to test for
open ports. I think I ... |
cElementTree.interparse() doesn't accept custom parser
Question: I parse XML file on Python with ElementTree. I found out that C implementation
of cElementTree work very fast comparing to regular one. But I have also
discovered construction:
xml.etree.cElementTree.iterparse(filename, parser=MyCystomParse... |
Scipy.cluster.vq.kmeans "list has no attribute shape"
Question: So this is a really weird problem I've been getting. I'm basically trying to
create a practice codebook which uses SIFT features of images that are
clustered by the kmeans algorithm in Python. However whenever I run the code I
get the following error
... |
reading data from arduino with python
Question: im trying to do something which arduino sends bunch of data frequently, and my
objective is:
1. every 100 data, make a new file. (lets call it a1, a2, ...)
2. in one generic file, take the average of each of these a files and write it inside of that file as a new li... |
Python turtle classes and methods: TypeError: 'method' takes exactly 2 arguments (1 given)?
Question: I'm writing a word prediction program using turtle as a GUI and I can't get
the code to work. My problem concerns the WordList class and the readlist
method in that class (near the end of the code). Here is the error m... |
How can I best isolate 2 different unlabeled pieces of html using beautiful soup to be printed to a CSV?
Question: To preface, I'm a python beginner and this is my first time using
BeautifulSoup. Any input is greatly appreciated.
I'm attempting to scrape all the company names and email addresses from [this
site](http:... |
Trying to parse Word docx file as a zip document using Python's xml.elementtree
Question: I'm trying to parse a Windows docx file as a zip file using Python's
xml.elementtree module. I saved the docx file as a zip. Below is what the
document looks like:
<?xml version="1.0" encoding="UTF-8" standalone="tr... |
wxpython with matplotlib doesn't initialize
Question: I tried to use `matplotlib` in `wxpython`, but there is some problem.
import wx
from matplotlib.figure import Figure
import numpy as np
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
class MplCanva... |
Downloading embedded Iframe videos from vimeo using python
Question: I have been looking all over and I see how to download vimeo videos using
python. I so far have this code.I can get to the parent page but I cannot do
anything to hit that iframe. I was thinking the best way to do this would be
login and hit the ifram... |
Inconsistent lxml.etree.xpath element counting between Mac OS and Linux hosts
Question: This problem has puzzled me for a while now. I am trying to scrape tables from
financial websites. For example, from barchart.com ( finviz.com same problem )
import lxml.html as lh
import lxml, urllib2
gL... |
DRY code for Google Cloud Endpoints APIs
Question: I want to avoid boilerplate code for creating Google Cloud Endpoints APIs for
different models of my Google App Engine application. Suppose I have a `Post`,
`User` and `Category` model. The data is stored in the datastore. I want to
create a REST API with the resources... |
Ending the GTK+ main loop in an Python MDI application
Question: I am trying to code an application that consists of various windows (e.g.,
generic message dialog, login dialog, main interface, etc.) and am having
trouble getting the `gtk.main_quit` function to be called: either I get a
complaint about the call being o... |
python imaging library: Can I simply fill my image with one color?
Question: I googled, checked the documentation of PIL library and much more, but I
couldn't find the answer to my simple question: how can I fill an existing
image with a desired color?
(I am using `from PIL import Image` and `from PIL import ImageDraw... |
Regex matching certain character in string pattern
Question: I have a example of many of string pattern like this but I want to show some
example.
from: [name: Illianney Amada
id: 674176087]
from: [name: Natalia Morel-Gibbs
id: 100003799207624]
from: [name: Jules Kaneyge ... |
Django Error loading MySqlDB module
Question: I'm new with Django and I follow a tuto. The problem is that the tuto uses
Sqlite but I want to use MySql server instead. I changed the parameters
following documentation but I have the following error when I try to run the
server. I already found some resolve but it didn't... |
Multiply all numbers in a generated list by an increasing number to reach a value python
Question: I want to multiply an integer with all the numbers in a list I generate until
a value of 65 is reached. I am starting off at 2(first prime) and multiply up
to 63(again all primes) until I reach 65. If a value is not reach... |
best way to implement Apriori in python pandas
Question: What is the best way to implement the Apriori algorithm in pandas? So far I
got stuck on transforming extracting out the patterns using for loops.
Everything from the for loop onward does not work. Is there a vectorized way
to do this in pandas?
im... |
python to node.js confusion
Question: So I have this python code that I'm trying to convert to node.js, but I am not
sure how.
import urllib.request, re
def getDef(word):
link = "http://www.merriam-webster.com/dictionary/%s" % word
data = urllib.request.urlopen(link).read().decode()
... |
SQLite AUTOINCREMENT column counter behavior with ON CONFLICT IGNORE clause
Question: When creating a small app using SQLite I've noticed a strange thing (for me)
with autoincrement columns counter algorithm behavior.
For instance, let's try to create database with the following schema
CREATE TABLE numb... |
pyqt auto connect signal
Question: I want use the autoconnection feature. I am using this example:
<http://www.eurion.net/python-
snippets/snippet/Connecting%20signals%20and%20slots.html>
it works, but I want to create my own signals and own slots, the example using
built in signals.
for example, here are a custom s... |
passing array as command line argument to python script
Question: I am calling a python script from a ruby program as:
sku = ["VLJAI20225", "VJLS1234"]
qty = ["3", "7"]
system "python2 /home/nish/stuff/repos/Untitled/voylla_staging_changes/app/models/ReviseItem.py #{sku} #{qtys}"
But I'd li... |
Getting invalid json in RoR
Question: I have an array sku = `["MAPNQ20673"]`. On converting this to json using
sku.to_json I'm getting `"[\"MAPNQ20673\"]"`. This is an invalid json. I need
to pass this array to a python script.
system "python2 /home/nish/stuff/repos/Untitled/voylla_staging_changes/app/mo... |
Trouble opening page with Python requests
Question: I am having some trouble opening a page with Python requests package. The page
opens fine in a browser, but the program will just hang when attempting to get
the site.
import bs4, requests
link = "http://s6.mediastreaming.it:8080/"
r = requ... |
how can I copy a string to the windows clipboard? python 3
Question: If I have a variable var = 'this is a variable'
how can I copy this string to the windows clipboard so I can simply Ctrl+v and
it's transferred elsewhere? I don't want to use anything that isn't that isn't
built in, I hope it's possible.
thanks!
A... |
multiprocessing - reading big input data - program hangs
Question: I want to run parallel computation on some input data which is loaded from a
file. (The file can be really big, so I use a generator for this.)
On a certain number of items, my code runs OK but above this threshold the
program hangs (some of the worker... |
Python - Infinite while loop, break on user input
Question: I have an infinite while loop that I want to break out of when the user
presses a key. Usually I use `raw_input` to get the user's response; however,
I need `raw_input` to not wait for the response. I want something like this:
print 'Press enter... |
Generate multi-page PDF without duplicating the template on each page?
Question: I'm working on an application which generates multi-page (sometimes hundreds
or thousands of pages) PDF documents for printing. Each page consists of a
generic template with some page-specific content superimposed (think:
automatically fil... |
python dictionary sorting in descending order based on values
Question: I want to sort this dictionary d based on value of sub key key3 in descending
order. See below:
d = { '123': { 'key1': 3, 'key2': 11, 'key3': 3 },
'124': { 'key1': 6, 'key2': 56, 'key3': 6 },
'125': { 'key1': 7, '... |
UnicodeDecodeError in Python while reading UTF-8 sql file from English Wikipedia
Question: **Update:** I have changed the encoding to
with open("../data/enwiki-20131202-pagelinks.sql", encoding="ISO-8859-1")
...and the program is now chewing through the file without complaint. Maybe
the SQL dumps a... |
Python: Getting value from Gevent Greenlet
Question: I'm learning Gevent, but can't get the value returned by the function called
in a greenlet. The following code:
import gevent.monkey
gevent.monkey.patch_socket()
import gevent
from gevent import Greenlet
import urllib2
imp... |
detect emoticon in a sentence using regex python
Question: Here is the list of emoticons:
<http://en.wikipedia.org/wiki/List_of_emoticons> I want to form a regex which
checks if any of these emoticons exist in the sentence. For example, "hey
there I am good :)" or "I am angry and sad :(" but there are a lot of
emoticon... |
Distribution independent libpython path
Question: Under newer Ubuntu/Debian versions, `libpython2.7.so` is under
`/usr/lib/i386-linux-gnu/libpython2.7.so` or `/usr/lib/x86_64-linux-
gnu/libpython2.7.so`, etc. Earlier, they could be found in
`/usr/lib/libpython2.7.so`, no matter the architecture. I haven't checked for
o... |
Parse english textual date expression into datetime
Question: How do I convert these strings:
one hour ago
three days ago
two weeks ago
yesterday
next month
into Python datetime object?
Answer: Just found [parsedatetime](https://pypi.python.org/pypi/parsedatetime/1.1.2)
for parsin... |
Pygame: Variable not updating each iteration
Question: I'm brand new to Python, so this is probably a simple problem. I want the code
to display "rotation: " followed by the value of the variable player_rotation.
It does this, but the value displayed does not by 1 every iteration (as I
would expect it to).
... |
Do things for a period of time program in python
Question: I made a program in python that looks like this:
import time
y = "a"
x = 0
while x != 10 and y == "a":
y = input("What is your name? ")
time.sleep(1)
x = x + 1
if y != "a":
print("Hi " + y)
else... |
UnicodeDecodeError Class Based Views, urls
Question: I have this in a app url, I cannot figure out what is wrong. and the "encoding
Error" I am learning from 2 scoops of django.
The problem is this It is this because when I comment out it's use everything
works fine
#!/usr/bin/env python
# -*- codin... |
Python - str() outputs non unicode
Question: I'm using the [py](https://pypi.python.org/pypi/py) library to rename .flac
files with information from its metadata. I'm having a problem with getting a
`LocalPath` object to a normal utf-8 string to run it into `subprocess`.
Here's the bit of code that goes wrong:
... |
Does the Python framework nose support testing a function which inititializes a daemon thread
Question: I am new on Stackoverflow and at Python. I wrote a simple Python program as
follows:
from threading import Thread
from Queue import Queue
import time
g_log_queue = Queue()
def prin... |
More efficient way to skip columns in csv to namedtuple function?
Question: I'm downloading a master data table from Bloomberg's Open Symbology. The csv
has columns that I'm not interested in.
**Question**
Is there an efficient/Pythonic way to produce namedtuple instances from a
subset of the columns found within a c... |
How suitable is opting for RethinkDB instead of traditional SQL for a JSON API?
Question: I am building the back-end for my web app; it would act as an API for the
front-end and it will be written in Python (Flask, to be precise).
After taking some decisions regarding design and implementation, I got to the
database p... |
Python which built in exception to use
Question: As I am sure you are well aware, python, as do most programming languages,
comes with [built-in
exceptions](http://docs.python.org/2/library/exceptions.html). I have gone
through the list, and cannot deduce which would be appropriate. Of course I
can make my own exceptio... |
Appengine endpoints-proto-datastore issue with user_required: No records returned
Question: I'm facing an issue on a deployed appengine app: It does not return me my
locations using Google's API explorer.
I did define a ./datastore_models/location.py file:
#!/usr/bin/env python
# -*- coding: utf-8 -... |
Building Pillow for PyPy - unresolved externals
Question: I've been struggling with building Pillow for PyPy (2.1) on my Windows (XP)
installation, using easy_install. Problems seems to be related to it missing
needed python/pypy header(?). I've been searching Google both up and down for
days, hoping to find a few who ... |
In Python, importing twice with class instantiation?
Question: In `models.py` I have:
...
db = SQLAlchemy(app)
class User(db.Document):
...
In my app both `serve.py` and `models.py` call:
from models import User
Is that double import going to instantiate the d... |
Deploying Flask app to Heroku - "Connection in Use"
Question: I'm deploying a simple Flask app to Heroku - (first time using Flask and
Heroku both). When I try to deploy, I get an "Application Error" and the page
tells me to try again in a few minutes. The logs state - the "connection [is]
in use", retries a few times ... |
Monitoring output of parallel subprocess in python 2.7 - pocketsphinx
Question: I'm new to python and maybe my problem might be rather obvious and simple.
My goal would be to run a pocketsphinx_continuous in parallel with my own
program. And when needed I would like to poll for output created by
pocketsphinx.
I found... |
netCDF to *.csv without Loops(!)
Question: I'm having some performance and 'ugly code' problem and maybe some of you can
help. I have to export data from **netCDF-files** to ***.csv**. For this I
wrote some python code. Let's take a 3-dim netcdf-File:
def to3dim_csv():
var = ncf.variables['H2O'] #e... |
Matplotlib: use 2 datasets different length datasets to plot x and y
Question: I've been trying to use file gages.txt for x axis values and file data.rei for
y axis values. I've run into an error because the two file are not the same
length. I want to plot a separate graph for each time the `pestID` in
`gages.txt` matc... |
Simple pygame program to fix
Question: I am new to Python and I have modified dodger (here's the link
<http://inventwithpython.com/dodger.py>) to add ''goodies'', sprites similar
to the baddies, but that give you score when you touch them; instead of
killing you as the baddies do. (I have made a change at the start wit... |
Can't communicate with MySQL from django, but can directly in python
Question: I'm setting up a django web site locally on Windows with Apache, django 1.6
and MySQL 5.5.8. I've created a test database and populated it with a couple
of sample records in the MyPHPAdmin interface. It has a user specifically for
django, wi... |
Python unittest, skip tests when using a base-test-class
Question: Whilst testing one of our web-apps for clarity I have created a
`BaseTestClass` which inherits `unittest.TestCase`. The `BaseTestClass`
includes my `setUp()` and `tearDown()` methods, which each of my `<Page>Test`
classes then inherit from.
Due to diff... |
Add url parameters in python
Question: This is my code to access a webpage but I need to add parameters to it: 1\.
First parameter is added by reading a line from file 2\. Second parameter is a
counter to continuously access pages
import urllib2
import json,os
f = open('codes','r')
for l... |
Python: Request handler in Flask
Question: I'm learning Flask, and the request handling seems to be like:
@app.route("/")
def hello():
return "Hello World!"
So I end up defining the functions for all my routes in a single file. I'd
much rather have functions for a model in its own file,... |
Travis special requirements for each python version
Question: I need unittest2 and importlib for python 2.6 that is not required for other
python versions that travis tests against.
Is there a way to tell Travis-CI to have different requirements.txt files for
each python version?
Answer: Travis CI adds an environmen... |
numpy function IOError
Question: On my macbook air running OSX Mavericks (I'm almost certain this wasn't
happening the other day on a PC running Windows 7 running virtually identical
code) the following code gives me the following error.
import numpy as np
massFile='Users/BigD/Dropbox/PhD/PPMS/D... |
Can I use one import and expose keywords from multiple python libraries?
Question: I am fairly new to Python and Robot, so please bare with me, but here is what
I am trying to do.
I am doing some automation on 2 mobile devices, and I have a library created
that allows me to communicate with these devices, provided to ... |
How do I disable a window?
Question: I am creating a ten question multiple choice quiz in Tkinter / Python.
Essentially in the parent window there are 13 buttons - help button, user
details, questions 1-10 and an 'End' button. Each button opens up a new window
with the question, the options as checkbuttons and radiobut... |
Send http post from android
Question: I have a server made in python that reads the querystring-message and stores
it in a sqlite database, and then displays the content.
Now I want to send the message from a android application. This is my code so
far.
import java.io.BufferedReader;
import java.io.... |
Drawing obtuse circular arc with arrowhead in matplotlib
Question: I am new to Python, though I do have previous programming experience. My
current interest is to generate good quality schematics (and maybe later on
also data graphs).
I need to draw a circlar arc with an arrowhead at the end point. I have sieved
throu... |
Python convert tuple to array
Question: How can I convert at 3-Dimensinal tuple into an array
a = []
a.append((1,2,4))
a.append((2,3,4))
in a array like:
b = [1,2,4,2,3,4]
Answer: Using [list
comprehension](http://docs.python.org/2/tutorial/datastructures.html#list-
co... |
wxPython TextCtrl assertion error: wx.wxEVT_COMMAND_TEXT_ENTER not a PyEventBinder instance
Question: Trying to make a wxPython `TextCtrl` to react on ENTER, I get an assertion
error:
self.fileNameInput = wx.TextCtrl (self, style=wx.TE_PROCESS_ENTER)
self.fileNameInput.Bind (wx.wxEVT_COMMAND_TEXT_ENT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.