text stringlengths 226 34.5k |
|---|
Python TLS handshake XMPP
Question: I'm trying to connect to an XMPP server using python. I have the XML to
connect, I'm just not sure how to do the TLS portion of the connection? I can
find lots of examples for HTTPS TLS and examples for XMPP just not how to put
both together.
Has anyone got an example of an XMPP con... |
php's strtr for python
Question: php has the [`strtr`](http://php.net/manual/en/function.strtr.php) function:
strtr('aa-bb-cc', array('aa' => 'bbz', 'bb' => 'x', 'cc' => 'y'));
# bbz-x-y
It replaces dictionary keys in a string with corresponding values and
(important) doesn't replace already re... |
PyDBG process snapshots not working
Question: I'm following Gray Hat Python book and have copied their code for the process
snapshots using PyDBG. When I run the script I get no errors and expected
output however my program is not actually reverting to the snapshot. When I go
in debug it seems like values are in the sn... |
Handling recurring events in a Django calendar app
Question: I'm developing a calendaring application in Django.
The relevant model structure is as follows:
class Lesson(models.Model):
RECURRENCE_CHOICES = (
(0, 'None'),
(1, 'Daily'),
(7, 'Weekly'),
(14, 'Biweekly')... |
Display an image read from a zip archive python
Question: I want to create a comic archive reader in python as an exercise to teach
myself more python but I've been having troubles trying to read different
image files from a zip archive without extracting the files and then display
them.
I found a website with an exam... |
How to print absolute line number in uncaught exception?
Question: When error occured Python prints something like this:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "<stdin>", line 8, in m
File "<stdin>", line 5, in exec_st
File "<stdin>", line 9, i... |
Parsing Source Code (Python) Approach: Beautiful Soup, lxml, html5lib difference?
Question: I have a large HTML source code I would like to parse (~200,000) lines, and
I'm fairly certain there is some poor formatting throughout. I've been
researching some parsers, and it seems Beautiful Soup, lxml, html5lib are the
mos... |
Decrease execution time for a given database-handling Python 2.7 program.
Question: The following function fetches data from a database:
def findid(name,parent):
conn = MySQLdb.connect (host = "localhost",
user = "arunkamaly",
passwd = "code"... |
Python dictionary optimize this script
Question: I have a string like `rdb_master_mongodb` where `rdb_` is fixed and `master`
is a database name which can be anything and `mongodb` can be one among
`mysql`, `mongodb`, `postgres`, `mssql` or `bdb`. I need to fetch the value
for this string from the dictionary which has ... |
Is there any API for formatting Sphinx text?
Question: I want to use Sphinx text converting in my Python program. For example, I have
a `string` variable which contains this text:
.. note::
This is a note.
.. code-block:: ruby
Some Ruby code.
and I want to call `mag... |
How to reproduce a wget-like speed interface on a linux terminal?
Question: Wget prints out speed information to stdout in a very clear manner, where the
speed is shown and refreshed whilst the file is downloaded, and a bar scrolls
across the screen. I'd like to replicate this sort of output, in a Python
program. How i... |
JPEG and PNG Library Use in PIL
Question: I'm relatively new to development and I've been attempting to setup an
application I'm building in Django (on Windows 7, 64 bit) to accept image
uploads via ImageField. I initially installed PIL, but found that I needed
JPEG and PNG libraries first. So I uninstalled PIL using "... |
Python Flask, SQLAlchemy relationship
Question: I've been trying to fix this problems for a few hours already, I cannot manage
to get SQLAlchemy working (it was working untill I put the two new functions,
User and Registration)
from flask.ext.sqlalchemy import SQLAlchemy
from . import app
from da... |
Why is Qt losing my thin space unicode character when loading an XML file?
Question: I have an XML document, part of which has the following in it:
<math display='block'><mtext> </mtext></math>
If this is loaded into Qt (specifically the Qt MathML widget where I found
this problem), the QDom... |
Using tweepy to access Twitter's Streaming API
Question: I'm currently having trouble getting example code for using tweepy to access
Twitter's Streaming API to run correctly (err...or at least how I expect it to
run). I'm using a recent clone of tweepy from GitHub (labeled version 1.9) and
Python 2.7.1.
I've tried ex... |
Detect if an image has a border, programmatically (return boolean)
Question: First off, I have read this post. [How to detect an image border
programmatically?](http://stackoverflow.com/questions/1954742/how-to-detect-
an-image-border-programmatically) He seems to be asking a slightly different
question, on finding the... |
AllegroGraph - UTF-8 characters in N-Triples
Question: When I use the AllegroGraph 4.6 Python API, I can use the
connection.addTriple() method to try to add a triple that ends in a literal
containing a unicode character (×):
`conn.addTriple( ..., ..., '5 × 10**5' )`
This doesn't work. I get the error:
`UnicodeDecode... |
Python: How to toggle between two values
Question: I want to toggle between two values in Python, that is, between 0 and 1.
For example, when I run a function the first time, it yields the number 0.
Next time, it yields 1. Third time it's back to zero, and so on.
Sorry if this doesn't make sense, but does anyone know... |
How to detect (view) an area of the screen surrounding a mouse pointer
Question: I'm on Linux, and want to try to recreate Nattyware's Pixie tool for my web
development. gPick is ok, but Pixie is just all around better.
I want to be able to detect and display the area around the mouse pointer.
I've been trying to find... |
Cannot compile mysql-python with XCode 4.3/homebrew
Question: Just installed XCode 4.3, now cannot install mysql-python package. I use OS X
Lion 10.7.4, XCode 4.3, homebrew, all installed just few hours ago. Using
homebrew'ed python 2.7.3, mysql 5.5.25
Here is the output:
(lukasz) ~ > pip install MySQL-... |
python django dynamic zipping and download
Question: I have a checkbox form. I am trying to make it so if a user checks the "video"
box and submits the form then the video files gets zipped and django generates
a dynamic download that pops up on the user screen. I want the same to happen
for the audio. BUT if the user ... |
python unhandled exception
Question: I am working with **MODO** python scripts. I imported the MODO setting data
into **.cfg** file with the **XML format** .
My .cfg file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<camera>
<Position>
<X>
2.0
... |
Powerful table widget for a Python GUI
Question: I'd like to program a table-like GUI. Do you know a powerful table widget (for
any GUI), which has ready-made functionality like filtering, sorting, editing
and alike (as seen in Excel)?
Answer: You can use wxGrid - here's some demo code - you need to manage/wire up al... |
Something like pyHook on OS X
Question: I am actually working with **pyHook** , but I'd like to write my program for
OS X too. If someone know such a module ... I've been looking on the internet
for a while, but nothing really relevant.
-> The idea is to be able to record keystrokes outside the python app. My applicat... |
Get raw POST body in Python Flask regardless of Content-Type header
Question: So, while ago I asked similar question: [How to get whole request POST body in
Python (Flask)](http://stackoverflow.com/questions/10434599/how-to-get-whole-
request-post-body-in-python-flask)
And I got an answer that actually `flask.request.... |
Hiding command-line dialog in py2exe
Question: Hi When I compile my python script with py2exe, everything works well except a
usless command-line dialog appears as well as my GUI. Any way to fix this? I
have python 2.7 and my setup script looks like this:
from distutils.core import setup
import py2ex... |
Would this be a reasonable use-case for lazy evaluation?
Question: I have a python class called Video, which represents YouTube videos. Given the
ID of a YouTube video, Video returns an object representing that video.
However, when a Video object is first created, YouTube is not queried. YouTube
is only queried once an... |
elaborate SQL query, count(*) limiter not working
Question: I'm afraid I'm no great shakes at SQL, so I'm not surprised I'm having trouble
with this, but if you could help me get it to work (doesn't even have to be
one query), I'd be grateful. trying to analyze some Twitter data using MySQLdb
in Python, I'm running:
... |
Python - checking for characters in date string
Question: I'm just kind of confused with Python at the moment. I want to ask the user to
input the date in a specific format. But I also want to check if there are two
"/" in the input. Ex: MM/DD/YYYY.... or else I would output an error message.
This is what I have so fa... |
Django redirect loop in form submit
Question: Just to clarify, this is the first time I'm putting a django website to
production.
I have a simple website in django that works locally. But when I deploy it in
the production server it enters in redirect loop when I submit a form. Then
the browser just tells me that a re... |
Extract function names and their comments from C code with python (to understand the Linux kernel)
Question: ## Backrground Information
I've just started to learn stuff about drivers and the linux kernel. I want to
understand how a user `write()` and `read()` works. So I started using
[ftrace](http://lwn.net/Articles/... |
How do I fix this image upload error in my website? Site is built on Python
Question: My site, which is built on Python/Postgresql with django, has an area where
you can upload an image. When I try to upload an image on it, nothing happens
and I receive this error message notification via e-mail:
> Traceback (most rec... |
Performance of individual vs. total import
Question: I've started to obsess about imports relative to instance spin-up latency. Got
me thinking...
I use a separate, central kinds.py module for all my Model.db class
definitions. Different handler/task modules will import the classes they use
from it. Was wondering abou... |
Plotting a masked surface plot using python, numpy and matplotlib
Question: I'm plotting a surface using matplotlib 1.1.0.
The plot Z axis is masked like so:
Zm = ma.masked_where((abs(z_grid) < 1.09) & (abs(z_grid) > 0.91), (z_surface))
surf = ax.plot_surface(X, Y,Zm, rstride=2, cstride=2, cmap=colo... |
Python: How to correctly use external functions
Question: This is something I've seen a fair bit of documentation on but I can't get an
exact answer to this specific gap in my knowledge and I keep running into
walls because of it, nothing seems to really cover it on this level:
I have a few windows, all of them should... |
How do I get SWIG to automatically wrap an emulated "this" pointer to a C struct?
Question: I've got a simple C "class" I have implemented, using function pointers in a
struct to implement the member functions, and passing a pointer to the struct
as the first argument to each function, similar to the implicit "this" po... |
Python - run Excel macro
Question: I would like to use Python to run a macro contained in MacroBook.xlsm on a
worksheet in Data.csv.
Normally in excel, I have both files open and shift focus to the Data.csv file
and run the macro from MacroBook. The python script downloads the Data.csv
file daily, so I can't put the m... |
Python Mechanize for form with options populated by Javascript
Question: I'm trying to use mechanize to grab prices for New York's metro-north railroad
from this site: <http://as0.mta.info/mnr/fares/choosestation.cfm>
The problem is that when you select the first option, the site uses javascript
to populate your list ... |
Change specific value in CSV file via Python
Question: I need the way to change specific value of the column of csv file. For example
I have csv file:
"Ip","Sites"
"127.0.0.1",10
"127.0.0.2",23
"127.0.0.3",50
and I need to change value 23 to 30 of the "127.0.0.2".
I use csv library: im... |
Eclipse PyDev Breakpoints Show an Different Icon and Don't Work
Question: Breakpoints have been working for me for many weeks, but yesterday they
stopped working. When I create a breakpoint icon shown is not the usual
magnifying glass, but instead is the magnifying glass with a line through it.
I tried the suggestions... |
python nested list: replace repeted items in nested list while retaining first occurrence
Question: I have a list of lists and want to replace all the occurrences of the same
word within the entire list/matrix with a dash except the first occurrence. I
have created a separate list that has a count of how many of each e... |
How can i use xaxis_date() with barh()?
Question: in the code below, bdate and edate are both datetime.datetime() objects:
pylab.barh(ypos, edate - bdate, left=bdate, height=TRMWidth )
but this throws an AttributeError way down in dates.py._to_ordinalf() :
> File "/Library/Frameworks/Python.framew... |
Pika basic_publish hangs when publishing on multiple queues
Question: I need to setup multiple queues on an exchange. I would like to create a
single connection, then declare multiple queues (this works) then, publish
messages on the multiple queues (this does not work).
I setup some test code to do this, but it gets ... |
How to execute shell command get the output and pwd after the command in Python
Question: How can I execute a shell command, can be complicated like normal command in
bash command line, get the output of that command and pwd after execution?
I used function like this:
import subprocess as sub
d... |
django remove tags from string python
Question: I want to remove all html tags except from my string with python i use this:
from HTMLParser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(s... |
Python win32com.adsi module limits number of returned members from AD
Question: Using the following code...
import win32com.adsi
DNC=win32com.adsi.ADsGetObject('LDAP://rootDSE').Get('DefaultNamingContext')
path = 'LDAP://cn=BIG_GROUP,ou=Groups,'+DNC
groupobj = win32com.adsi.ADsGetObject(... |
Best way to eliminate duplicates in a list, but keep previous relative order
Question: > **Possible Duplicate:**
> [How do you remove duplicates from a list in Python whilst preserving
> order?](http://stackoverflow.com/questions/480214/how-do-you-remove-
> duplicates-from-a-list-in-python-whilst-preserving-order) ... |
parsing a tab-separated file in Python
Question: I'm trying to parse a tab-separated file in Python where a number placed k
tabs apart from the beginning of a row, should be placed into the k-th array.
Is there a built-in function to do this, or a better way, other than reading
line by line and do all the obvious proc... |
how do I make a fork or non-blocking system call in python
Question: This is related to [this
question](http://stackoverflow.com/questions/204017/how-do-i-execute-a-
program-from-python-os-system-fails-due-to-spaces-in-path) but with a
different take.
In Ubuntu, I use Autokey, which uses python to automate keystrokes ... |
qmtest not running on CENTOS. build on Mac OS x
Question: I downloaded qmtest for Mac OS X, and build and installed it on MAc OS-X m/c
and then copied the relevant site-packages/binary file into CENT-OS m/c so
that I could run qmtest from cENT-os m/c.
But an error that I am getting.
Traceback (most rece... |
background process in python with -e option on terminal
Question: I want to write a console based wrapper to launch a program, and it works fine
unless I try to run it using 'urxvt -e myscript' or some variant. For example:
test.py
#!/usr/bin/python2.7
import subprocess
print 'Press enter t... |
Call non-native Java code from Python
Question: I want to be able to call certain methods and such that are contained in a
Java jar that is already running (It is guaranteed that it will be running). I
have found things like Jython, but those only seem to be able to access Java's
native classes and such.
Answer: **Ch... |
Symbol not found: _PQbackendPID with Django project
Question: Running on MAC os 10.6.8 with postgresSQL installed, as well django - using
python2.7 Also installed psycopg2 and dj-database-url using pip in my virtual
env And added these two lines to my setting.py:
import dj_database_url
DATABASES = {'... |
python 3 new to classes
Question: I'm .self taught in python and need some help with a really simple class I'm
trying to write. I would like to use everything outside of the InitLog class
in various modules WITHOUT needing to declare a new class variable everytime i
use it (eg i dont want to declare betty = Initlog in ... |
PySide - QSvgWidget renders embedded SVG files incorrectly
Question: I try to render embedded svg file using QSvgWidget. My file "front.svg" looks
like this:
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="500" height="500" id="svgfile">
<rect style="fill:#ff0000... |
regular expression to split
Question: I try to understand the regex in python. How can i split the following
sentence with regular expression?
"familyname, Givenname A.15.10"
this is like the phonebook in python regex
<http://docs.python.org/library/re.html>. The person maybe have 2 or more
familyn... |
dynamically instantiate classes in Python
Question: I want to dynamically add `threading.Thread` classes to a thread `queue` based
on a database query. Is that possible?
For example:
import threading, Queue
class worker(threading.Thread):
def run(self):
while True:
... |
Using a loop to check a date with datetime in python?
Question: I am writing a program that uses a gathers information from a file to output
later on, my problem right now is with testing the information given. I want
to test if the code the user inputted is the same as a date in the file. The
file used contains dates ... |
Is it possible to iterate through all nodes with py2neo
Question: Is there a way to iterate through every node in a neo4j database using py2neo?
My first thought was iterating through `GraphDatabaseService`, but that didn't
work. If there isn't a way to do it with py2neo, is there another python
interface that would l... |
How is Shop class supposed to be access in line 60 of shopify.Session in the shop method
Question: I am trying to use python shopify api with OAuth2 and working through the api,
and am trying to move the the django auth sample over to oauth rather than
legacy (and not use django, I am just targetting webapp2 on appengi... |
python unhashable type - posting xml data
Question: First, I'm not a python programmer. I'm an old C dog that's learned new Java
and PHP tricks, but python looks like a pretty cool language.
I'm getting an error that I can't quite follow. The error follows the code
below.
import httplib, urllib
url ... |
Python simple string formatting error
Question: This is my script which is supposed to parse a list of domains (each seperated
by returns) in a .txt file, separate them into individual domain names, send a
request to a whois site with the domain name, check the response to see if it
is available, and if it is, write it... |
Django: Is Base64 of md5 hash of email address under 30 characters?
Question: I am investigating since a few hours the best way to use the Email address
instead of username in Django authentication. This topic has been discussed
many times but the given results are inconsistent.
1) The answer [here](http://stackoverfl... |
jython Can't list error
Question: I am trying to convert a python class into Java byte code with Jython (on mac
osx lion)
> ./jython -m compileall /Users/owengerig/Downloads/Code\
> Downloads/cryptPYTHON.py
but get this error, which gives no indication of whats wrong
> Listing /Users/owengerig/Downloads/Code Downloa... |
Is it possible to make an alias for a module in Ruby?
Question: In Python, you can set an alias for a module with 'as':
import mymodule as mm
But I can't seem to find an equivalent for ruby. I know that you can `include`
rather than `require` a module, but this risks namespace collisions. Is there
... |
Python classes--Need explanation
Question: I have a general question on the class definition and its use..THe below code
from one of the book works fine but I have a general questions.
Here we have defined a class Point and creating 2 instance Point1 & Point2.
When calculating the distance for point2, how can we pass ... |
Replace a string located between
Question: Here is my problem: in a variable that is text and contains commas, I try to
delete only the commas located between two strings (in fact `[` and `]`). For
example using the following string:
input = "The sun shines, that's fine [not, for, everyone] and if it ra... |
Error on "pip install --upgrade distribute"
Question: Installed python via homebrew as such:
brew install python --universal --framework
Followed the instructions over at
<https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python> to install pip and
upgrade distribute. pip install appeared to go fi... |
Solution: Python3 Tkinter Jump from one window to another with back and next buttons
Question: I've been studying tkinter in python3 and find it very hard to find good
documentation and answers online. To help others struggling with the same
problems I decided to post a solution for a simple problem that there seems to... |
python lxml find <fb:comments /> tag
Question: I'm using lxml to parse an html that has a facebook comments tag that looks
like that:
<fb:comments id="fb_comments" href="http://example.com" num_posts="5" width="600"></fb:comments>
I am trying to select it to get the href value but when i do a
`css... |
PyV8, can I manipulate DOM structure?
Question: Lets assume that we have PyV8:
import PyV8
ctxt = PyV8.JSContext()
and a python DOM structure, for example `xml.dom`
How can I feed a .js-file to PyV8 so that it could change DOM-structure that I
have.
If I had it's content:
$("#... |
Log in Profile in python
Question: Is there any way that we can print the user name of the person who has logged
in the system in the file? the file is an output file of python.
Answer: You could look into `os.environ`.
In [1]: import os
In [2]: os.environ['LOGNAME']
Out[2]: 'lev'
|
How to make XPath return 'None' in Python if no data found?
Question: XPath returns nothing if a child element has no text value. In this case,
rating has no data, so I want it to say so - None or nothing in this child
instead of just ignoring it. Your input is much appreciated.
**XML :**
<?xml version=... |
Python multiprocess debugging
Question: I'm trying to debug a simple python application but no luck so far.
import multiprocessing
def worker(num):
for a in range(0, 10):
print a
if __name__ == '__main__':
for i in range(5):
p = multiprocessing.Pr... |
How to create a loop that shuts down when given answer in python?
Question: what I am wanting to do is randomly generate two numbers that equal a given
number. Yet to allow for this to get the desired answer I want it to be
random. That is the problem.
a=(1,2,3,4,5,6,7,8,9,)
from random import choice... |
Python Tkinter Listbox Unbind the Default Selection
Question: I find this feature of automatic selection to item index 0 in the Listbox a
nuisance. In my script, I have 3 listboxes called lb1,lb2 and lb3. If user
selects any items on lb2 or lb3, I intend to pop up a MessageBox to ask the
user to only select items from ... |
What if I put two kinds of encoded strings, say utf-8 and utf-16, in one file?
Question: In Python, for example:
f = open('test','w')
f.write('this is a test\n'.encode('utf-16'))
f.write('another test\n'.encode('utf-8'))
f.close()
That file gets messy when I re-open it:
f... |
Python OpenCV stereo cam blind one?
Question: My system is Linux HPDebian 3.2.0-2-amd64 #1 SMP x86_64 GNU/Linux Python 2.7,
OpenCV2 I can use only 1 cam. My question is How to get a video feed from 2
cams ? I had read c++ version but I prefer python. It is easier for non-
programmer.
I don't understand why my webcam w... |
How to compare one element of one array numerically to another element in another array in python
Question: I am new to python and made two arrays for two tab delimited input files.I was
searching for a way to compare the column(element) of one array numerically to
element of another array. Is there any way to do that.... |
How to parse this web page (and convert into a dictionary) in Python
Question: I want to fetch some data from a certain web page (online book store).
The web pages look like this: <http://www.rob389.com/dp/tr/11/9789754681383>
I want to parse the `<script>` section that contains the following string:
t... |
Where does GAE store permalinks?
Question: So I have the following code GAE code in python and it is a little long but
basically it allows a user to post to a blog and then saves each blog post to
a permalink which the user is redirected to and the user can relink to
forever. The permalink url is just blog/(the blog po... |
format conversion of an image in python
Question: I have to write an application for image processing in python. does anyone
know how to convert the file type of an image from JPEG to TIFF?
Answer: Check out the [Python Image Library
(PIL)](http://www.pythonware.com/products/pil/). See this
[tutorial](http://effbot.o... |
Application Layout with Groups of single items in Python
Question: I am coming from the PHP world, worked a lot with Joomla. Now I am building a
Python web application and I my first step is to create a user management when
I faced a very basic question: How do you manage all users in one class, when
your model represe... |
Convert non-UTC time string with timezone abbreviation into UTC time in python, while accounting for daylight savings
Question: I am having a hard time converting a string representation of non-UTC times to
UTC due to the timezone abbreviation.
**(update: it seems that the[timezone abbreviations may not be
unique](htt... |
How to get layout correct for matplotlib FigureCanvas in wx.Notebook panel
Question: I've been struggling with this for a few days now. If I don't use a
wx.Notebook, I can get the FigureCanvas to size correctly within a sizer, but
once I place the FigureCanvas inside of a wx.Notebook panel, the plot seems to
ignore the... |
nginx + uwsgi + flask - disabling custom error pages
Question: Is it possible to disable nginx's custom error pages - if I may call them that
- to display my framework's exception pages?
I can't really see my werkzeug debugger tool rendered in html...
**UPDATE**
OK, I got to make a very very simple flask application... |
python parse file
Question: I have a file with username and emails, in this format :
pete,pbellyer@gmail.com
I want to only keep the email, so i thought about using a regex like this :
import re,sys
Mailfile = sys.argv[1]
file = open(Mailfile, "r")
for MAIL... |
How can I update the textctrl content in GUI?
Question: I am trying to write my first wxpython GUI program,in my program,I want to get
anothor software window's title,if the title change,clear the old title and
show the new title in GUI,I test in cmd,it can get the title in a loop,but I
don't konw how to set a event in... |
python read last three lines from kernel log
Question: I want to read the last three lines from the kernel log `/var/log/messages` in
a loop.
for i in xrange(0,100):
# do_stuff()
file = open('/var/log/messages')
lines = file.readlines()[-3:]
# analyse_stuff()
file... |
How to patch Python class using Mock library
Question: I'm having trouble patching a class for my testing. I'm trying to patch
something that belongs to Scrapy - a
[HtmlXpathSelector](http://scrapy.readthedocs.org/en/latest/topics/selectors.html?highlight=HtmlXPath#scrapy.selector.HtmlXPathSelector)
class.
Here is som... |
Django Help: AttributeError: 'module' object has no attribute 'Charfield'
Question: I have seen several similar posts of other attributes found but not this. New
to Python and Django- I've done the first part of the several tutorials
including Django's "Polls" tutorial and when it gets to the point where I
syncdb for m... |
Python: How to differ these two functions with each other
Question:
def a():
""" Need to write something here."""
def test1():
return a()
def test2(x):
return x
I would like to do this in python interpreter:
test1()
test2(a())
So what I ... |
Objects With No Behavior
Question: I'm thinking about a situation where I have an object "Transaction", that has
quite a few properties to it like account, amount, date, currency, type, etc.
I never plan to mutate these data points, and calculation logic will live in
other classes. My question is, is it poor Python de... |
Can one partially apply the second argument of a function that takes no keyword arguments?
Question: Take for example the python built in `pow()` function.
xs = [1,2,3,4,5,6,7,8]
from functools import partial
list(map(partial(pow,2),xs))
>>> [2, 4, 8, 16, 32, 128, 256]
bu... |
ImportError: django.utils not found in Google app engine
Question: I get this error when I use simplejson from django.utils in google app engine
project:
Traceback (most recent call last):
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 187, in Handle
... |
Embedding HTML in an rst2pdf list-table
Question: I'm using [`rst2pdf`](https://code.google.com/p/rst2pdf/) 0.92 on linux, and I
am trying to embed html inside a `list-table` directive, as shown in [Dimitri
Christodoulou's blog](http://dimitri-christodoulou.blogspot.com/2012/01/how-
to-embed-html-in-restructuredtext.ht... |
Getting either “DLL load failed” or python-exception in demandimport, when using mercurial on trac, this time on Windows 2008 R2, 64 bit
Question: [This question](http://stackoverflow.com/questions/5158523/dll-load-failed-
when-using-mercurial-on-trac), asked in 2011, and on a different operating
system (XP instead of ... |
'int' object has no attribute '__getitem__'
Question:
import math
import os
class collection:
col = [[0 for col in range(5)] for row in range(6)]
dist = [[0 for col in range(6)] for row in range(6)]
filename = ""
result = ""
def __init__(self,arg1):
... |
Error message for virtualenvwrapper on OS X Lion
Question: I've used homebrew to install python on a new Mac Lion installation, and have
been trying to install virtualenv and virtualenvwrapper with pip, but when I
start a new terminal session, I get this traceback:
Traceback (most recent call last):
... |
Getting RabbitMQ and Graphite to connect
Question: I'm trying to connect RabbitMQ to Graphite(0.9.9) using
<https://github.com/somic/graphite-rabbitmq> However, I'm not entirely sure
which directory in Graphite the graphite-rabbitmq files should be placed.
When I run `carbon-agent-rabbitm1.py` I get
Fai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.