python

Putting images in a Tkinter

How can I place an image in a Tkinter GUI using the python standard library? ...

Retrieving netmask for interfaces with multiple IP addresses using Python?

I need to list the available network interfaces and their IP addresses and corresponding netmasks using Python in a Linux environment. I can get the interfaces and the IP addresses of each interface using ioctl and SIOCGIFCONF as outlined here, but I'm at loss when it comes to determining the netmask when there are multiple IP address o...

google code + temp server?

Hi, We are starting a new project to develop a website using django. We have created a project on google code. We would like to be able to occasionally show the progress of the site to some people, without having to purchase a real server. We are all modifying the project through eclipse and SVN. What's the best way to create a runser...

[python]How to add Auto-scroll on insert in Tkinter Listbox?

I'm using a listbox (with scrollbar) for logging: self.listbox_log = Tkinter.Listbox(root, height = 5, width = 0,) self.scrollbar_log = Tkinter.Scrollbar(root,) self.listbox_log.configure(yscrollcommand = self.scrollbar_log.set) self.scrollbar_log.configure(command = self.listbox_log.yview) Now, when I do: self.listbox_log.insert(EN...

How can we call the CLI executables commands using Python

How can we call the CLI executables commands using Python For example i have 3 linux servers which are at the remote location and i want to execute some commands on those servers like finding the version of the operating system or executing any other commands. So how can we do this in Python. I know this is done through some sort of web...

extracting individual items resulting from a string split() operation

a = line.splitlines()[:2] I got this output as shown below . ['GET /en/html/dummy.php?name=MyName&married=not+single &male=yes HTTP/1.1'] ['Host: www.explainth.at'] ['User-Agent: Mozilla/5.0 (Windows;en-GB; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11'] ['Accept: text/xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'] ['Accep...

Python bizarre class problem

Hi, I have the following piece of code where I try to override a method: import Queue class PriorityQueue(Queue.PriorityQueue): def put(self, item): super(PriorityQueue, self).put((item.priority, item)) However, when I run it I get TypeError exception: super() argument 1 must be type, not classobj What is the problem? ...

SQLAlchemy memory hog on select statement

As per the SQLAlchemy, select statements are treated as iterables in for loops. The effect is that a select statement that would return a massive amount of rows does not use excessive memory. I am finding that the following statement on a MySQL table: for row in my_connections.execute(MyTable.__table__.select()): yield row Does ...

Library for kademila end emule

Anyone known a ruby (or at least python or java) library for kademila and emule? ...

__init__, inheritance and variadic parameters

I'd like to subclass an existing scons class (named SConsEnvironment) which has the following __init__ prototype: def __init__(self, platform=None, tools=None, toolpath=None, variables=None, parse_flags = None, **kw): In my own class...

Avoid localization of some values in django templates

I have a model with a FloatField that has to be rendered in a template without localization and another FloatField that has to be rendered with localization. How can you disable localization for certain values? ...

error on running my application in Django with mod_python

I have win32,python2.5,django1.2, apache2.2, and mod_python3.3.1 I have installed properly mod_python. Now my application name is myapp.setting which path is c:\myapp.setting. In myapp.settings my file is myapp.settings\url.py,settings.py etc. now in apache httpd.conf file I have changes following:- <Location "/mysite"> SetHandler...

how can I consume django web service in C# ?

python - django webmethod returns simplejson.dumps, how can I convert the simplejson string into C# 2.0 Object ? for example, dict -> Hashtable string -> String ... is there any JSON Serializable library in existing .NET framework or any 3rd party tool ? ...

Multiple inheritance in django. Problem with constructors

Hi, I have a model like this: class Person(models.Model,Subject): name = .. The class Subject is not supposed to be in the Database so, it doesn't extends from models.Model: class Subject: def __init__(self,**kargs): _observers = [] my problem is that the constructor of Subject is never called, so i've tried adding ...

Google App Engine's db.UserProperty with rpxnow

Hi, We have a Django project which runs on Google App Engine and used db.UserProperty in several models. We don't have an own User model. My boss would like to use RPXNow (Janrain) for authentication, but after I integrated it, the users.get_current_user() method returned None. It makes sense, because not Google authenticated me. But w...

How to create/modify the controller class generated by pylons?

Say I wanted to add some imports to the file generated when I run: paster controller controllern_name Is this possible? ...

Word sense disambiguation in NLTK Python

Hello friends, I am new to NLTK Python and i am looking for some sample application which can do word sense disambiguation. I have got a lot of algorithms in search results but not a sample application. I just want to pass a sentence and want to know the sense of each word by referring to wordnet library. Thanks I have found a similar...

Writing to a particular cell using csv module in python

I have to write a value to a particular cell (say the 8th cell) in my csv file. I can see there is a csvwriter.writerow(row) method to write an entire row, but I am not seeing anything to write a value to a particular cell. ...

Web based large files upload with resume facility in django or asp.net

Hi We are looking for an approach for developing a web based application which should have facility to upload large files (size upto 10 GB) with resume facility. We want to develop this application using python/django or C#/asp.net. Any suggestion would be appreciated. ...

Getting formatted datetime in Python like in PHP

Hello, How to get formatted date time in Python the same way as in PHP date('M d Y', $timestamp);? ...