Solaris python 2.4.3:
from collections import defaultdict
does not exist..
Please advise what could be an alternative to use multi-level dictionaries:
dictOut['1']['exec'] = 'shell1.sh'
dictOut['1']['onfailure'] = 'continue'
...
dictOut['2']['exec'] = 'shell2.sh'
dictOut['2']['onfailure'] = stop'
many thanks
applom
...
I need to compile a 32-bit distribution of PyEphem. It does not seem like this should be difficult, however, I'm running into some compiler issues.
$ CFLAGS=-m32 python setup.py bdist -p i386
running bdist
running bdist_dumb
running build
running build_py
running build_ext
building 'ephem._libastro' extension
gcc -pthread -fno-strict-al...
I am trying to send out an ARP request with python, working with dpkt, and I found some sample code that uses:
socket.socket(socket.PF_PACKET, socket.SOCK_RAW)
I understand that you need to use raw sockets to send this, but it says that socket.PF_PACKET doesn't exist. And there is nothing in the python docs about it that I have seen. ...
I have been using MATLAB for my work, but I have started learning Python lately. I employ statistical analysis, more precisely geostatistics, in my work. I was wanting to ask, from your perspectives, which one among the two languages is good for statistical analysis? What are the pros and cons, other than accessibility, for each?
...
I am trying to get a web page using the following sample code:
from urllib import urlopen
print urlopen("http://www.php.net/manual/en/function.gettext.php").read()
Now I can get the whole web page in a variable. I wanna get a part of the page containing something like this
<div class="methodsynopsis dc-description">
<span class="t...
I've taken to putting module code directly in a packages __init__.py, even for simple packages where this ends up being the only file.
So I have a bunch of packages that look like this (though they're not all called pants:)
+ pants/
\-- __init__.py
\-- setup.py
\-- README.txt
\--+ test/
\-- __init__.py
I started doing this because...
I recently read Eric Steven Raymond's article "How To Become A Hacker" and I like his suggestion of learning 5 key languages (he suggests Python, C/C++, Lisp, Java, and Perl) as a way of covering the main programming paradigms in use today.
His advice is that it's not so important which specific languages a programmer knows. It's more ...
I'm new to Python. I'm currently on Py3k (Win).
I'm having trouble installing a .py file. Basically, i want to use the recipes provided at the bottom of this page. So i want to put them inside a .py and import them in any of my source codes.
So i copied all the recipes into a recipes.py file and copied them to C:\Python3k\Lib\site-pack...
Actually i'm using R + python with RPY2 to manipulate data and ggplot to create beautiful graphics.. i have some data in postgresql database, and i'm using psycopg2 to querying data.
I'm starting thesis, and in the future i need OLAP cube to store my (very big) simulation data : multiple dimension, aggregation query, etc.
Is there any ...
What are the best practices and solutions for managing dynamic subdomains in different technologies and frameworks? I am searching for something to implement in my Django project but those solutions that I saw, don't work. I also tried to use Apache rewrite mod to send requests from subdomain.domain.com to domain.com/subdomain but couldn...
Hello,
I have a wx.toolbar with some buttons. One of the buttons makes pan left!
I want to click on the button and while I keep it pressed, the pan left is made.
For now I only saw that the wx.EVT_TOOL only works when mouse left is up.
Is there a way to do what I intend ?
...
Hi All, I am after a PHP Script to login to YouTube and Upload videos (the standard YouTube API does not do what I a after). I have found the exact thing I am after:
http://broadcasterproject.wordpress.com/2010/03/03/howto-youtube-auto-upload-script/
or maybe even this:
code.google.com/p/youtube-upload/
But they are both in Python. ...
I'm wondering if it wouldn't be a better if Python would store the compiled code in a file stream of the original source file. This would work on file systems supporting forks/data-streams, and fall-back if this is not possible.
On Windows using ADS (Alternative Data Streams)
On OS X using resource forks
On Linux using extended file at...
Hi I have a List say 100 items, now i want a slice of say 6 items which should be randomly selected. Any way to do it in very simple simple concise statement???
This is what i came up with (but it will fetch in sequence)
mylist #100 items
N=100
L=6
start=random.randint(0,N-L);
mylist[start:start+L]
...
Having properly configured a Development server and a Production server, I would like to set up a Staging environment on Google App Engine useful to test new developed versions live before deploying them to production.
I know two different approaches:
A. The first option is by modifying the app.yaml version parameter.
version: app-sta...
I'm creating a GUI with Tkinter, and a major part of the GUI is two Treeview objects. I need the contents of the Treeview objects to change when an item (i.e. a directory) is clicked twice.
If treeview items were buttons, I'd just be able to set command to the appropriate function. But I'm having trouble finding a way to create on-click...
Hello,
I am using ctypes to wrap a C-library (which I have control over) with Python. I want to wrap a C-function with declaration:
int fread_int( FILE * stream );
Now; I would like to open file in python, and then use the Python file-object (in some way??) to get access to the underlying FILE * object and pass that to the C-function...
I'm trying to add generic relations and one-to-one relations support for django-test-utils makefixture command, here is the source http://github.com/ericholscher/django-test-utils/blob/master/test_utils/management/commands/makefixture.py
Does somebody have ideas how to do this? Or may be there is another tool for such thing as:
./manag...
I'm having major trouble with a get_or_create call. I have it working locally absolutely fine, and the same script is working online on another site. Has anyone got an idea what's going on?
I get "IntegrityError: (1062, "Duplicate entry '2147483647' for key 'PRIMARY'")" whenever I run the script...
for tweet in TwitterSearchFeed.entri...
Does python have an equivalent to Tcl's uplevel command? For those who don't know, the "uplevel" command lets you run code in the context of the caller. Here's how it might look in python:
def foo():
answer = 0
print "answer is", answer # should print 0
bar()
print "answer is", answer # should print 42
def bar():
u...