I want to record sound (voice) using PortAudio (PyAudio) and output the corresponding sound wave on the screen. Hopeless as I am, I am unable to extract the frequency information from the audio stream so that I can draw it in Hz/time form.
Here's an example code snippet that records and plays recorded audio for five seconds, in case i...
I ported gchecky to the google app engine. you can try it here
It implements both level 1 (cart submission) and level 2 (notifications from google checkout).
Is there any other payment option that works on the google app engine (paypal for example) and supports level 2 (notifications)?
...
In a program that I'm writing, I wanted to make a ConfigParser that's read only so that it can safely be used globally. I didn't realize this, but apparently the SafeConfigParser is an old-style class, thus I had to subclass it like this:
class ConstParser(SafeConfigParser, object):
"""This is a implementation of the SafeConfigPar...
ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.
Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.
name = "Thomas Winter"
print name.split()
and what would be output is just "Winter"
...
In my Python app, I have an XML document that I'd like to transform using my XSL file. I'm currently using xml.etree to generate the XML document, but I haven't found anything within Python 2.5 that will allow me to natively transform my XML document.
I've already found one library (libxslt) which can execute the transformation, but I ...
I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):
>>> regex_dict = { re.compile(r'foo.') : 12, re.c...
A colleague is looking to generate UML class diagrams from heaps of Python source code.
He's primarily interested in the inheritance relationships, and mildly interested in compositional relationships, and doesn't care much about class attributes that are just Python primitives.
The source code is pretty straightforward and not tremend...
I have a file and I don't know how big it's going to be (it could be quite large, but the size will vary greatly). I want to search the last 10 lines or so to see if any of them match a string. I need to do this as quickly and efficiently as possible and was wondering if there's anything better than:
s = "foo"
last_bit = fileObj.readl...
How can i play audio (it would be like a 1sec sound) from a python script?
It would be best if it was platform independent, but first of it needs to work on a mac.
I know i could just execute the 'afplay file.mp3' command from within python, but is it possible to do it in raw python? I would also be better if it diddnt rely on external...
Most of the documentation available for building Python extension modules
uses distutils, but I would like to achieve this by using the appropriate
python autoconf & automake macros instead.
I'd like to know if there is an open source project out there that does
exactly this. Most of the ones I've found end up relying on a setup.py file...
I am developing a piece of software in python that will be distributed to my employer's customers. My employer wants to limit the usage of the software with a time restricted license file.
If we distribute the .py files or even .pyc files it will be easy to (decompile), and remove the code that checks the license file.
Another aspect i...
Hi,
I have a list of tuples like this:
[
('a', 1),
('a', 2),
('a', 3),
('b', 1),
('b', 2),
('c', 1),
]
I want to iterate through this keying by the first item, so for example I could print something like this:
a 1 2 3
b 1 2
c 1
How would I go about doing this without keeping an item to track whether the first item is the same as I...
I have a debug app I've been writing which receives data from a C-based process via UDP. One of the strings sent to me contains a '°' character - http://en.wikipedia.org/wiki/Degree_symbol">Unicode U+00B0 (which incidentally breaks the StackOverflow search function!). When my wxPython application tries to append that string to a text box...
Is there any way to make a function (the ones I'm thinking of are in the style of the simple ones I've made which generate the fibonnacci sequence from 0 to a point, and all the primes between two points) run indefinitely. E.g. until I press a certain key or until a time has passed, rather than until a number reaches a certain point?
...
In Linux When I invoke python from the shell it replicates its environment, and starts the python process. Therefore if I do something like the following:
import os
os.environ["FOO"] = "A_Value"
When the python process returns, FOO, assuming it was undefined originally, will still be undefined. Is there a way for the python process (o...
I am currently trying to create a win32 service using pywin32. My main point of reference has been this tutorial:
http://code.activestate.com/recipes/551780/
What i don't understand is the initialization process, since the Daemon is never initialized directly by Daemon(), instead from my understanding its initialized by the following:
...
I'm pretty sure there should be a more Pythonic way of doing this - but I can't think of one: How can I merge a two-dimensional list into a one-dimensional list? Sort of like zip/map but with more than two iterators.
Example - I have the following list:
array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
I want to have
result = [12, 15, 18] #...
I'm sorry I could not think of a better title.
The problem is the following:
For our customer we have created (as part of a larger application) a
graphical designer which they can use to build "scenario's".
These scenario's consist of "Composites" which in turn consist
of "Commands". These command objects all derive from CommandBase a...
Is there any Ruby equivalent for Python's builtin zip function? If not, what is a concise way of doing the same thing?
A bit of context: this came up when I was trying to find a clean way of doing a check involving two arrays. If I had zip, I could have written something like:
zip(a, b).all? {|pair| pair[0] === pair[1]}
I'd also acce...
if I paste this into the command prompt by hand, it works, but if I run it from python, I get The filename, directgory name, or volume label syntax is incorrect.
os.system('%comspec% /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86')
os.system('devenv Immersica.sln /rebuild Debug /Out last-build.txt')
...