text stringlengths 226 34.5k |
|---|
How can I download a file to a specific directory?
Question: I have been recently trying to make a program in python that downloads files
to a specific directory. I am using Ubuntu and so far i have this
import os
import getpass
import urllib2
y = getpass.getuser()
if not os.acc... |
Python Rar All File In Directory, Each File Different Directory
Question: It feels like this is a colossally stupid question, but the documentation for
rar as a whole is pretty sketchy, and using python to rar pulls an insane
number of hits, none of them even seem to be attempting what I'm trying to do
(which I find so... |
AttributeError: 'NoneType' object has no attribute 'str' in suds
Question: I am using suds client for WSDL in our project.
i have this code .
sudsclient = sudsClient(settings.WSDL_URL)
values = {
"MerchantCode": settings.YP_MERCHANT_CODE,
... |
Incorrect value - python to model in Django
Question: The problem I have is when trying to insert some values in the database
created by Django model, the values are strictly numeric, but when trying to
insert it I get an error:
567523
<type 'int'>
Warning: Incorrect integer value: 'id' for c... |
Python cdecimal InvalidOperation
Question: I am trying to read financial data and store it. The place I get the financial
data from stores the data with incredible precision, however I am only
interested in 5 figures after the decimal point. Therefore, I have decided to
use t = .quantize(cdecimal.Decimal('.00001'), rou... |
Sending stdin to subprocess in python script
Question: I have a python script which requires the opening of another terminal window
to send some commands. Stackoverflowers have already gotten me that far:
import subprocess
server_terminal = subprocess.Popen(['open','-a','/Applications/Utilities/Termi... |
Image spot detection in Python
Question: I have millions of images containing every day photos. I'm trying to find a
way to pick out those in which some certain colours are present, say, red and
orange, disregarding the shape or object. The size may matter - e.g., at least
50x50 px.
Is there an efficient and lightweig... |
Importing Archived TweetStream Twitter Ouput into Mongodb?
Question: I have around 1000 lines of twitter data captured using python tweetstream.
The data was collected using the simple tweetstream example of:
>>> stream = tweetstream.SampleStream("username", "password")
>>> for tweet in stream:
.... |
argparse: usage reporting for individual choices of a positional argument?
Question: I'm trying to refactor a program to use the new standard argparse module.
Given the structure below, should I be using
[choices](http://docs.python.org/library/argparse.html#choices) for the
primary positional argument,
[subcommands](h... |
Deferred_output for cyclical iteration in Python 2.x
Question: [Here](http://code.activestate.com/recipes/576961-technique-for-cyclical-
iteration/) I found a very good recipe of how to calculate a sequence of
number using a technique with **deferred output**.
I decided to use the same technique to solve the second pr... |
Python importing a module: how to track its orgin PYTHONPATH, sys, os
Question: the module nosetests runs everywhere on my computer (it shouldn't it should
only run in a few specified places). I guess this is because i have
accidentally added the module nosetests to the PYTHONPATH either by putting it
directly in eithe... |
Google App Engine e-mail and attachment extensions
Question: In Google App Engine for python can I send e-mails with attachments that have
no extension? What are the allowed extensions? Can I send zip files as
attachments?
Answer: No you cannot send attachments with no extension. Last time I checked (SDK
1.6.3) all t... |
How to call a web-service using JavaEE?
Question: I've been using rpclib to auto-generate a WSDL and implement it in Python.
Then I wanted to call a web-service* that has this WSDL using JavaEE, so I
simply used the **Web Service from WSDL** option in the creation wizard in
Eclipse (Indigo 3.7.1 with OEPE), but then t... |
Need a good beginner's WSGI guide
Question: I have an almost complete simple web app written as a Python CGI script. I
would like to change it to use WSGI, but I can't find documentation that helps
me make sense of what WSGI actually is (one only repeatedly finds calls with
start_response etc. but there doesn't seem to... |
How to set SQLite PRAGMA statements with SQLAlchemy
Question: I would like SQLAlchemy to put the SQLite .journal file in-memory to speed up
performance. I have tried this:
sqlite_db_engine = create_engine('sqlite:///%s' % str(dbname), connect_args = {'PRAGMA journal_mode':'MEMORY', 'PRAGMA synchronou... |
Ignore unicode in xml with python and lxml?
Question: I'm looking to either ignore the unicode within my xml. I'm willing to somehow
change it as well in the processing of the output.
My python:
import urllib2, os, zipfile
from lxml import etree
doc = etree.XML(item)
docID = "-".join(d... |
tastypie -- OAuthAuthentication -- python-oauth2 import issue
Question: I am wishing to use OAuthAuthentication in tastypie. In my ModelResource, I
do: (showing only the relevant portion)
`from tastypie.authentication import OAuthAuthentication
class FooResource(ModelResource):
class Meta:
... |
Some questions on dendrogram - python (Scipy)
Question: I am new to scipy but I managed to get the expected dendrogram. I am some more
questions;
1. In the dendrogram, distance between some points are `0` but its not visible due to image border. How can I remove the border and make the lower limit of y-axis to `-1`,... |
OpenCv CreateImage Function isn't working
Question: I'm trying to create an image using opencv v 2.1, but I get that error :
image=cv.CreateImage((w,h),no_of_bits,channels) AttributeError: 'module'
object has no attribute 'CreateImage'
The code is
#!/usr/bin/python
import cv
from opencv im... |
ImportError: cannot import name cached_property
Question: I am trying to set up Tipfy extensions on a Python/Google App Engine project
that I've been brought in on. I have followed all the instructions for running
bootstrap.py and then bin/buildout. Everything seems to have worked but now
when I try to import tipfy.ext... |
Python: function to fetch data always returns None
Question: I have this list of dictionaries:
cust = [
{"id": 1, "name": u"name 1", "bill_amount": 1000},
{"id": 2, "name": u"name 2", "bill_amount": 5000},
{"id": 3, "name": u"name 3", "bill_amount": 7600},
... |
Newbie Django: Creating a project with several apps or all in one
Question: I am begginer in the Django world, I developed some "information sites"
(nothing complicated) but this week my boss order me to make a migration of a
big software that has 7 modules.
So I went to read the documentation page and search in googl... |
More elegant way to create a list of 2D points in Python
Question: I need to create a list of 2D points (x,y) in python. This will do it
l = []
for x in range (30,50,5):
for y in range (1,10,3):
l.append((x,y))
So: `print l` will produce:
[(30, 1), (30, 4... |
python pycurl giving for soap error of gnutls
Question: While trying pycurl for some url
def call_soap_curl(ncServerURL, xml, action):
c = pycurl.Curl()
c.setopt(pycurl.URL, ncServerURL)
c.setopt(pycurl.POST, 1)
c.setopt(pycurl.SSL_VERIFYPEER, 0)
c.setopt(pycurl.SSL_VE... |
Do I have to do StringIO.close()?
Question: Some code:
import cStringIO
def f():
buffer = cStringIO.StringIO()
buffer.write('something')
return buffer.getvalue()
The
[documentation](http://docs.python.org/library/stringio.html#StringIO.StringIO.close)
says:
> `Stri... |
Python function translate relative path ../../ into full path
Question: is there a function that translate relative path ../test.txt into a full path?
example:
the full path is:
/Users/paganotti/Documents/Project/simple/work/paga/
the relative path is:
../test.txt
I want build... |
Numpy array assignment
Question: I've written a very simple python numpy code. It have a strange behavior...
from numpy import *
# generate 2 array with 15 random int between 1 and 50
pile = random.randint(1, 50, 15)
pile2 = copy(pile)
print("*** pile2",type(pile2),pile2)
print("... |
Python -- how to loop over range starting at random point
Question: I have a list of categories (1-4) and I want a loop to iterate over all of
them. But I need to be able to start with a random category and wrap around to
the beginning of the list if my starting point was ahead of list[0].
I was able to do it in a rat... |
Using wxOverlay ontop of widgets?
Question: I have created a button in this rubberbands example. The rubber bands do not
appear over the button, I would like the rubberbands to appear over the
button.
import wx
print wx.version()
class TestPanel(wx.Panel):
def __init__(self, *args, ... |
Python regex, searching for prefixes inside a target string
Question: I need to find a **list of prefixes** of words inside a **target string** (I
would like to have the list of matching indexes in the target string handled
as an array).
* I think using **regex** should be the cleanest way.
* Given that I am looki... |
TypeError: cannot concatenate 'str' and 'builtin_function_or_method' objects in python
Question: Please I am beginner in python coding.This is my code and am not able to
resolve the error . Can some one suggest me what is the prob in code actually.
thanks in advance.
import urllib2
username = '<YOUR ... |
Import Python file from within executing script
Question: I am attempting to import a python file(called test.py that resides in the
parent directory) from within the currently executing python file(I'll call it
a.py). All my directories involved have a file in it called init.py(with 2
underscores each side of init)
*... |
python not detecting changes if importing from root
Question: For some reason, my changes aren't reflected if I import a class relative to
the root. Here's an example:
root/__init__.py
subdir/__init__.py
bar.py
If I cd to subdir and do:
>>> from bar imp... |
Glade catalog picks wrong version of glib module
Question: On Fedora 16, I have a catalog library of widgets that I wish to load into
glade. Normally, this should be easy but since I have different versions of
glib and gobject installed, the following error occurs:
; GLADE_CATALOG_PATH=./Components GLADE... |
Setting a timeout for mechanize.Browser
Question: I was perusing the question posted here:
[What should I do if socket.setdefaulttimeout() is not
working?](http://stackoverflow.com/questions/8464391/what-should-i-do-if-
socket-setdefaulttimeout-is-not-working)
to try and come up with a solution to kill requests when ... |
NameError when using "self" in class?
Question: I have the following Python (3.2) code:
from pygame import *
class Application:
def __init__(self):
self.running = True
self.display_surface = None
self.size = self.width, self.height = 640, 480
... |
Ye olde UnicodeEncodeError printing results from a query on MS SQL with adodbapi
Question: Python novice here.
I am using python2.7.2 on Windows7.
I have installed the PyWin32 extensions (build 217).
I have adopdbapi installed in `c:\Python27\Lib\site-packages\adodbapi`
I have a very simple module that queries the ... |
Nested for loop in python
Question: I'm trying to learn the python scripting . Being some body who started coding
in c/c++ or java i'm finding it extremely hard to find ways to write loops in
python , especially **for** loops with conditions
I've a list A of string, i need to do a specific op on these strings a pair a... |
Should I get results in real time while my webserver is running if I haven't done any html for a google app engine web app?
Question: when I run it against localhost it shouldn't show anything if I haven't made
any html right? Or is it because of some kind of database issue? I checked the
page source and there is nothi... |
Python for ios interpreter
Question: > **Possible Duplicate:**
> [Python or Ruby Interpreter on
> iOS](http://stackoverflow.com/questions/4772591/python-or-ruby-interpreter-
> on-ios)
I just discovered this apps
[pypad](http://users.on.net/~jon.dowdall/pypad/index.html) and [python for
ios](http://pythonforios.com/... |
How to convert integer into date object python?
Question: I am creating a module in python, in which I am receiving the date in integer
format like `20120213`, which signifies the 13th of Feb, 2012. Now, I want to
convert this integer formatted date into a python date object.
Also, if there is any means by which I can... |
Encoding a 128-bit integer in Python?
Question: Inspired by the "encoding scheme" of the answer to [this
question](http://stackoverflow.com/questions/742013/how-to-code-a-url-
shortener), I implemented my own encoding algorithm in Python.
Here is what it looks like:
import random
from math import po... |
Python Parameters (beginner)
Question: I need help with parameteres. Do both of these function definitions do the
exact same thing for print_twice?
def print_twice(lol):
print lol
print lol
def print_twice(michael):
print michael
print michael
If yes, then I... |
How to fix default Python path after installing Virtualenv
Question: I installed virtualenv via `sudo pip install virtualenv` and created some
environments. But now I'm finding my default "global" Python path is
completely gone.
In a fresh terminal, I see output like:
user@localhost:~$ sudo pip install ... |
Python Project Issue: Import from parent folder or change project architecture
Question: I have a problem with my Python project. My project parses different recipe
websites for each recipe and writes the recipe data to a text file.
**My Problem:** I cannot import a python file/module that resides in the
parent direct... |
Python: Read HTML source from URL and get date into program
Question: I'm a beginner at Python and I want to read info from a site and get some of
the data as output in my textbox (I use EasyGUI). I have found this to get the
HTML source of a URL but now I want to work with the HTML output, I know how
to work with XML ... |
In Python, when a function doesn't need an object prefix?
Question: In `sorted(list(mydict.keys()))`, `sorted` and `list` doesn't need an object
prefix `someobject.`, but `keys()` needed `dict1.`. When, or for what
functions, is the prefix necessary?
Answer: _Methods_ need to be called on a specific object. _Function... |
How to get a list of variables in specific Python module?
Question: Let's assume I have the following file structure:
**data.py**
foo = []
bar = []
abc = "def"
**core.py**
import data
# do something here #
# a = ...
print a
# ['foo', 'bar', 'abc']
I nee... |
How to check if an element of a list is a list (in Python)?
Question: If we have the following list:
list = ['UMM', 'Uma', ['Ulaster','Ulter']]
If I need to find out if an element in the list is itself a list, what can I
replace _aValidList_ in the following code with?
for e in list:... |
time.sleep requires integers?
Question: I'm writing a macro that will click certain spots on the screen when I press a
key.
The first time I press a key, everything runs fine.
However, any other key press results in the error:
time.sleep(0.1)
TypeError: an integer is required
Here is the... |
What does the PEP's status and structure mean?
Question: What is the PEP status' structure and mean?
These days, I try to write a python2.7 interpreter.
But, I don't know why comparison operator <> arise in python 2.7. (It was not
in python 3.0) Figure out it was in the PEP401. The official declarations is
for future... |
Loading large amount of data into Postgres Hstore
Question: The hstore documentation only talks about using "insert" into hstore one row
at a time. Is there anyway to do a bulk upload of several 100k rows which
could be megabytes or Gigs into a postgres hstore.
The copy commands seems to work only for uploading csv fi... |
Import web2py's DAL to be used with Google Cloud SQL on App Engine
Question: I want to build an app on App Engine which uses Cloud SQL as backend database
instead of App engine's own datastore facility (which doesn't support common
SQL operations such as JOIN).
Cloud SQL has a DB-API and hence I was looking for a ligh... |
How to create an SQL View with SQLAlchemy?
Question: Everything is in the title. Is there a "Pythonic" way (I mean, no "pure SQL"
query) to define an SQL view with SQLAlchemy ?
Thanks for your help,
Answer: **Update:** See also the SQLAlchemy usage recipe
[here](https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageReci... |
How do a load a python package resource from the current distribution using pkg_resources?
Question: I have a Python package with some css stylesheets which I have included as
resources like so:
from setuptools import setup
setup(
package_data={
'my.package.name': ['*.css']
... |
Put python doctest at the end of the code file?
Question: I can put python doctests in the bodies of each function, which I sometimes
like for small libraries, because they are in the same file as the function.
Or I can put them all together into a seperate file and execute the separate
file, which is nice in case I d... |
Show more levels of exception in Python traceback
Question: I'm catching exceptions in context managers, however I don't see all levels of
reraised exceptions. Anyone knows how to improve this?
import traceback
def f():
try:
raise Exception("Interesting")
except Excep... |
Why are references to instance methods stored in each instance object rather than in the class object?
Question: From what I understand, each instance of a class stores references to the
instance's methods.
I thought, in concept, all instances of a class have the same instance
methods. If so, both memory savings and l... |
Issue in generating the xml file from python minidom
Question: Here is the code:
from xml.dom.minidom import Document
doc = Document()
root = doc.createElement('root')
doc.appendChild(root)
for i in range(1,3):
main = doc.createElement('item class:=memory')
root.a... |
Connecting to LibreOffice with named pipes
Question: I can connect with sockets just fine, but I heard that using pipes is faster
when everything is local, so I wanted to try it out, but I can't get a
connection.
I start Libre with
> soffice --headless --invisible --norestore --nodefault --nolockcheck ... |
writing to csv, Python, different data types
Question: I'm new to Python and would like to write data of different types to the
columns of a csv file.
I have two lists and one ndarray. I would like to have these as the three
columns with the first row being the variable names.
Is there are a way to do this in one lin... |
python mechanize session not saved
Question: I'm trying to use python mechanize to retrive the list of apps on iTunes
connect. Once this list is retrieved, further work will be done with those
links.
Logging in succeeds but then when i follow the "Manage Your Applications" link
I get redirected back to the login page.... |
Importing everything to the current namespace from a module in ipython
Question: I want to import everything in a module to the global namespace in an IPython
session. So I tried `from <module> import *`, but that doesn't work. Although
this works as expected in a python session. How can I do this in IPython?
I realis... |
Python list to insert to other table or list
Question: Hi pythonist I am newbie here. I have a table with duplicate date and field2
as id of sale
table_sale
field1 field2 field3 field4 field5
3/16/2012 a KONDRA I KOMANG 1 TERAPI OZON 60... |
Change count into an array of letters, python
Question: I am struggling with an idea I want put into a python script. I'm not even
sure how to ask the most appropriate question as I've been surfing through the
net trying to find what I want with no luck.
Basically, I have a script that does a simple calculation:
... |
R/XLL: Interface to call XLL method in R
Question: I am trying to call the methods defined in the XLL addin(for Excel) from R.
Something similar to this Python code:
import os
from win32com.client import Dispatch
Path = 'myxll.xll'
xlApp = Dispatch("Excel.Application")
xlApp.RegisterXLL... |
Why does Python's math.factorial not play nice with threads?
Question: Why does math.factorial act so weird in a thread?
Here is an example, it creates three threads:
* thread that just sleeps for a while
* thread that increments an int for a while
* thread that does math.factorial on a large number.
It calls ... |
shared axes in scatter plots in matplotlib
Question: I am trying to put two scatter plots next to each other with a shared y axis,
but the axis seems to get an odd scale. Without the shared axis the two plots
look fine. I also noticed that the problem does not occur when using "plot"
instead of "scatter". Images are in... |
App Engine - AttributeError: 'function' object has no attribute 'id'
Question: I'm using App Engine, SDK 1.6.3 with Python 2.7.
I've created a model like this:
class MyModel(db.Model):
name = db.StringProperty()
website = db.StringProperty()
I can iterate and see everything except ... |
Running 'top' in thread produces SIGTTOU
Question: For reasons I won't go into, I need to run a variant of 'top -m io -d 2 10'
within a subprocess from a Python thread on FreeBSD 8.1. The trouble is, it
seems that sometimes SIGTTOU gets produced (under certain code-dependent
conditions that I haven't yet deciphered), h... |
pipe "less" content out, when "less" get content from stdin
Question: In "ipython", we use `some_obj??` to get documentation, which uses "less" to
show the docs. How can we get the document out of "less", into a text editor?
The content is fed from stdin, so pressing "v" gives the error: "can not edit
standard input"
... |
How to determine if Python script was run via command line?
Question: ## Background
I would like my Python script to pause before exiting using something similar
to:
`raw_input("Press enter to close.")`
but only if it is NOT run via command line. Command line programs shouldn't
behave this way.
## Question
Is ther... |
Python: import a lib with a non-py extenson
Question: I have to import library which is called `functions.sage`. How can I do it? I
tried:
__import__('functions.sage')
and also this:
import imp
imp.load_source('fun', 'functions.sage')
**Edit** :
Actually I want to import [... |
What's the fastest way to iterate over a CvMat in Python using OpenCV?
Question: I'm using OpenCV with Python to process a video stream. I'd like to implement
my own algorithm, so I need to iterate over each frame.
What I have so far works, but way too slow to be real-time. I know that Python
isn't the most efficient ... |
Importing module in django installed with easy_install
Question: I just installed django-stdimage with easy_install on my server.
It told it me installed successfully at
/home/myuser/lib/python2.4/django_stdimage-0.2.2-py2.4.egg
How do I import stdimage with django to start using it?
Answer: Found the answer. Easy_... |
py2app picking up .git subdir of a package during build
Question: We use py2app extensively at our facility to produce self contained .app
packages for easy internal deployment without dependency issues. Something I
noticed recently, and have no idea how it began, is that when building an
.app, py2app started including... |
How to have an 'if' within a loop?
Question: I'm trying to solve a problem whereas, but I feel the loop I've got has a
missing link somewhere...
The brief I've been given - "Now write a program that calculates the minimum
fixed monthly payment needed in order pay off a credit card balance within 12
months."
In essenc... |
how does a python program tell if it's being run within emacs?
Question: I usually write python in emacs.
I'll often want to re-evaluate my file, which I can do with Ctrl-C Ctrl-C,
which causes the interpreter to reload the entire file and then I can carry on
playing.
so if I'm writing a program that takes input, I'l... |
How Can a LAMP Guy Easily Implement WebSockets?
Question: I've always worked with Apache, MySQL, and PHP. I'd like to eventually branch
out to Python/Django or Ruby/Ruby on Rails, but that's another discussion. Two
great things about Apache, MySQL, and PHP are all three are ubiquitous and
it's very easy to launch a web... |
Encode Decode of strings python
Question: I have a list of html pages which may contain certain encoded characters. Some
examples are as below -
<a href="mailto:lad%20at%20maestro%20dot%20com">
<em>ada@graphics.maestro.com</em>
<em>mel@graphics.maestro.com</em>
I would like to dec... |
python overwrite previous line
Question: how do you overwrite the previous print in python 2.7? I am making a simple
program to calculate pi. here is the code:
o = 0
hpi = 1.0
i = 1
print "pi calculator"
acc= int(raw_input("enter accuracy:"))
if(acc>999999):
print "WARNING... |
ChromeDriver under FreeBSD
Question: With FreeBSD-7.3 amd64 and Python 2.6 I cannot make it possible to run
ChromeDriver. ChromeDriver binary is added to path and Chrome works fine in
appropriate display but I keep getting errors related to binary
incompatibility or something similar _ELF binary type "0" not known._ :
... |
Python simple linear plotting
Question: So I'm trying to plot 2 different arrays of the same dimensions using python's
matplotlib. This is the code I currently have:
from numpy import *
from pylab import *
import matplotlib.pyplot as plt
p, pdot, s400, dist=loadtxt("cc45list.txt", usecols=(1,... |
Perl - regex How to write this in python?
Question: I wrote the following `regex` in `perl` and now i want to write it in
`python`.
if ($textline =~ /^([A-Z0-9]+:)(.*)/)
Answer:
>>> import re
>>> textline = "AZERTY:qwerty"
>>> if re.search('^([A-Z0-9]+:)(.*)', textline):
... p... |
Django Tweepy File
Question: I’m confused about this; instead of writing tweepy codes like-
auth=tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api=tweepy.API(auth)
In a new python file (IDLE). Can’t we write it in our views.... |
Python hash function as Twisted xmlrpc class issueing same has for every file?
Question: I'm new to most of this so forgive me if I'm doing something really dumb. The
following is a simple Twisted xmlrpc server which is supposed to return file
info. It works fine except that the `xmlrpc_hash` function gives the same
re... |
How to tell pythons numpy where to find liblapack.so.3?
Question: So I have to run some python scripts on a cluster with machines for which I
have no admin rights. Since numpy was missing, on some of the machines, I
created a virtual environment and installed numpy there. I connected to a
machine from which I knew it h... |
Plot a sequence of images with matplotlib Python
Question: I'm implementing the kmeans clustering algorithm in Python. I would like to
plot at each iteration the status (image) of the clusters quality. So,
basically I have a cycle which plot at each iteration an image and I want to
animate this. I don't know if I made ... |
double click a file to run python script. how to get that file as an input?
Question: I want to be able to create a program that can save text files with my own
extension at the end. later the user should be able to double click on that
file to run the program and open that file.
I need to know how to make the python ... |
Python Command Line Arguments (Windows)
Question: I am running 32-bit Windows 7 and Python 2.7.
I am trying to write a command line Python script that can run from CMD. I am
trying to assign a value to sys.argv[1]. The aim of my script is to calculate
the MD5 hash value of a file. This file will be inputted when the s... |
Find Out If a Function has been Called
Question: I am programming in Python, and I am wondering if i can test if a function has
been called in my code
def example():
pass
example()
#Pseudocode:
if example.has_been_called:
print("foo bar")
How would I do this?
Answer: If... |
i want python to open a wesite and then refresh it or reopen it a sertain amount of times
Question: here is what i have so far:
loop = 1
print ("Copy your Youtube link")
Website = input (">>>")
print ("How manmy views would you like to get?")
Views = input (">>>")
print (Website)
... |
Why Twisted resource.Resource execute render() twice?
Question: Im new to Twisted. Why is it printing "render()" twice? I know if I return
server.NOT_DONE_YET, it will only print once, but I wish to return string/JSON
instead. Any help?
Code:
from twisted.web import resource, server
from twisted.int... |
Setting output of a program to pipe in Python 2.6.6
Question: I was wondering how I would redirect the output of a program I would run with
subprocess.Popen to the program I am using. For example, if I'm executing a
script from Python ImageProcessing.py in.jpeg out.jpeg, I would like to
instead do some extra processing... |
fastest packing of data in Python (and Java)
Question: ([Sometimes](http://www.codinghorror.com/blog/2009/01/the-sad-tragedy-of-
micro-optimization-theater.html) our host is wrong; nanoseconds matter ;)
I have a Python Twisted server that talks to some Java servers and profiling
shows spending ~30% of its runtime in t... |
Fetching href of a link
Question: I am using lxml and python. I want to fetch the **href** for the link that
reads **More reviews (40)** on this
[page](http://maps.google.com/maps/place?cid=2860002122405830765). I am
basically scrapping this site and want to get the reviews.
Would appreciate the help. Thanx
Answer:... |
Broadcast error when adding ndarray and sparse matrix converted to dense in python
Question: I am converting from a scipy sparse matrix to a dense matrix and adding that
to an ndarray using a += operator and I am getting a broadcast error. The
ndarray has a shape (M,) while the dense matrix has a shape (M,1). When I tr... |
PyCrypto: Decrypt only with public key in file (no private+public key)
Question: Hello everyone.
I am trying to play a bit with RSA public and private keys and
encryption/decryption with _PyCrypto_ and I have encountered and issue that
seems kind of strange to me (it probably makes a lot of sense the way it's
working ... |
Python Matplotlib Colormap
Question: I use the colormap "jet" to plot my graphics. But, I would like to have the
lower values in white color and this colormap goes from blue to red colors. I
also don't want to use another colormap because I need this range of colors...
I tried to make my colormap to get the same as "je... |
Python tkinter .pack/.pack_forget memory issue
Question: I've been teaching myself Python for a few months now and have proceed into
learning some GUI techniques.
I wrote this simple script based off a pack_remove example I found within a
book. My script simply displays local and UTC time every second. Granted the
onl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.