I was interested in doing some cross platform work with a usb device in python, any tips or recommendations on modules that can do this type of thing?
I've looked around SF and googlecode without a lot of luck.
thanks!
ct
...
I'm writing a python application that runs several subprocesses using subprocess.Popen objects.
I have a glade GUI and want to display the output of these commands (running in subprocess.Popen) in the gui in real time.
Can anyone suggest a way to do this? What glade object do I need to use and how to redirect the output?
...
Hi.
I'm implementing TDMA in Python using NumPy. The tridiagonal matrix is stored in three arrays:
a = array([...])
b = array([...])
c = array([...])
I'd like to calculate alpha-coefficients efficiently. The algorithm is as follows:
# n = size of the given matrix - 1
alpha = zeros(n)
alpha[0] = b[0] / c[0]
for i in range(n-1):
a...
According to The Django Book, Django's templating system supports nested dot lookups:
Dot lookups can be nested multiple levels deep. For instance, the following example uses {{ person.name.upper }}, which translates into a dictionary lookup (person['name']), then a method call (upper()): '{{ person.name.upper }} is {{ person.age }}...
I have a problem with python-config --ldflags on OS X 10.6.2.
Using my non-system python.org python install:
robin-mbp:~ robince$ which python
/Library/Frameworks/Python.framework/Versions/2.5/bin/python
robin-mbp:~ robince$ python-config --ldflags
-L/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config -ldl -lpython2....
Say you want to pass a dictionary of values to a function, or otherwise want to work with a short-lived dictionary that won't be reused. There are two easy ways to do this:
Use the dict() function to create a dictionary:
foo.update(dict(bar=42, baz='qux'))
Use an anonymous dictionary:
foo.update({'bar': 42, 'baz': 'qux'})
Which do...
hi there got a couple of probs, say in my text file i have:
abase
abased
abasement
abasements
abases
This coding below is meant to find a word in a file and print all the lines to the end of the file. But it doesnt it only prints out my search term and not the rest of the file.
search_term = r'\b%s\b' % search_term
for line in op...
Hi,
Trying to publish a stream to facebook using py facebook. The stream publishes a single attachment perfectly i.e media or name or href , e.t.c
But when it comes to appending all the attachments in one line it breaks down and just publishes the message.
attachment = [media,description] etc does not work.
message = "Test Message...
Hello,
I need to download a zip archive of text files, dispatch each text file in the archive to other handlers for processing, and finally write the unzipped text file to disk.
I have the following code. It uses multiple open/close on the same file, which does not seem elegant. How do I make it more elegant and efficient?
zipped = ur...
We have a web service which serves small, arbitrary segments of a fixed inventory of larger MP3 files. The MP3 files are generated on-the-fly by a python application. The model is, make a GET request to a URL specifying which segments you want, get an audio/mpeg stream in response. This is an expensive process.
We're using Nginx as th...
I have a site with Django running some custom apps. I was not using the Django ORM, just the view and templates but now I need to store some info so I created some models in one app and enabled the Admin.
The problem is when I log in the Admin it just says "You don't have permission to edit anything", not even the Auth app shows in the ...
I want to remove all occurrences of URL [full path, query string] from the text in Python. Any suggestions on how to do this? I am new to regex!
http://example.com/url/?x=data
This whole URL should be removed!
Thanks
...
I am new to PyTables, and am looking at using it to process data generated from an agent-based modeling simulation and stored in HDF5. I'm working with a 39 MB test file, and am experiencing some strangeness. Here's the layout of the table:
/example/agt_coords (Table(2000000,)) ''
description := {
"agent": Int32Col(shape=(), d...
Hello.
I have a problem. I've got a string which looks like "var1,var2" and table in database which contains some records looks like "var1, var3", "var3", "var2,var3" an I want to filter them by splitting first string. When any of my string-variable fits to database-variable django will display them. So, when I have string-var like this...
This is a great regular expression for dates... However it hangs indefinitely on this one page I tried... I wanted to try this page ( http://pleac.sourceforge.net/pleac%5Fpython/datesandtimes.html ) for the fact that it does have lots of dates on it and I want to grab all of them. I don't understand why it is hanging when it doesn't on o...
I'm following the official documentation to run Django on IIS 5.1.
http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer
I get PyISAPIe installed successfully, so that the Info.py file loads, but when I try to set-up the test app the URL loads in my browser stating "Directory Listing Denied."
I suspect I'm missing som...
A Python script at Google App Engine fetches data into a HTML page.
What is the best way to open a new browser window from the script or HTML page?
JavaScript doesn't work.
...
Can you use PyCrypto with py2exe? Can you use any arbitrary library for that matter with py2exe?
Thanks,
Chris
...
If I have something like the following class
class Foo
{
private:
int _bar;
public:
Foo& operator=( const Foo& other )
{
_bar = other._bar;
return *this;
}
}
Is there an easy way to export that functionality to python using boost::python? The documentation does not list and nice and easy
.def( self =...
I have a SQLAlchemy model with a one-to-many relationship between table x and table y. The record (if any) with the greatest id in table y where y.x_id = x.id is special. Class X and class Y map tables x and y.
I know how to define X.all_y (ORDER BY y.id). How do I define X.latest_y equivalent to X.all_y[-1]?
...