python

how does execfile() work in python ?

does the file which is sent as an argument to execfile runs as an independent process / thread or is the code imported and then executed ? . Also i wanted to know how efficient is it compared to running threads / process . ...

does anybody know a simple base for a plug in python application?

I'm discovering python, and I want to create a plug in application, I guess this is simple using python, but it will be nice create a generic start point application. To be more specific, it could be a file.py that reads a XML or INI file to get the plug in's directory path, then load all .py files as plug in Any Ideas? ...

How do I access command line arguments in Python?

I use python to create my project settings setup, but I need help. I tried reading but can't find info to do this: $python myfile.py var1 var2 var3 In my Python file I need to use all vars that are input. ...

What do i build my alpha platform on, PHP, Ruby, Python, .NET, etc?

I am developing a social networking website in the facebook/foursquare-ish space. I have gotten such varied feedback on what platform I should develop in. Of course it will be heavily influenced by who I hire, but i was hoping for a little additional feedback from the larger community. Thanks. ...

How to create a raw socket(customised TCP header) using dpkt?

i m writing a code for port scanner so i need to send a raw packet. i searched and found out that using dpkt library would be better but i didnt find any documentation that would help. So please anyone could help may explaining how to create a packet with customized TCP header i.e set the flags of tcp header as required. Thank You ...

Tweepy twitter oauth authentication not returning oauth_verifier

I am using a python library called "tweepy" for twitter. When I try to authorize the user, twitter is supposed to redirect to a callback url with auth_token and oauth_verifier. I am getting only auth_token in the url. Anyone else had the same problem? ...

Performing caldav-queries using the CalDAVClientLibrary

I am trying to query the Apple Calendarserver via the Python CalDAVClientLibrary. I can connect to the server, list the available calendars and read out the whole calendar, also I am able to store a new event.For these operations, caldav uses the HTTP-Methods GET, PUT, REPORT and PROPFIND. As an example (assuming there is at least one c...

Apache Chainsaw with Python and multiple tabs

I am using Apache Chainsaw with python (using the XMLLayout formatter, sending log messages to Chainsaw) How can I make Chainsaw display multiple log tabs, one for each logging source ? currently it displays all messages, regardless of which process sent them, to a single tab ...

How can I use HTML + Javascript to build a python GUI ?

I have been experimenting with Appcelerator Titanum yesterday and I think it's cool when it comes to Javascript. Python features on Appcelerator Titanum are so limited (can't use some modules for example). My question is How can I use html & javascript as a GUI tool for a real python application ? I am running windows 7 and i wa...

Fastest DNS library for python

Hi What library is the fastest to make hundreds of DNS queries in multi-tasking. I've googled round DNS libraries for python. I found that adns is said to be fastest. But it's not Windows-compatible. Are there any cross-platform compatible DNS libraries for python? ...

django site administration (entering fixtures data)

I have a django site. a snippet of myapp/models.py looks like this: class Continent(models.Model): name = models.CharField(max_length=128, db_index=True, unique=True) class GeographicRegion(models.Model): continent = models.ForeignKey(Continent, null=False) name = models.CharField(max_length=128, null=False) When I am a...

Understanding __call__ and list.sort(key)

I have the following code I am trying to understand: >>> class DistanceFrom(object): def __init__(self, origin): self.origin = origin def __call__(self, x): return abs(x - self.origin) >>> nums = [1, 37, 42, 101, 13, 9, -20] >>> nums.sort(key=DistanceFrom(10)) >>> nums [9, 13, 1, 37, -20, 42, 1...

Python: Parsing JSON String List for Each JSON Object

I use the json module and the dumps method to obtain a string which represents a list of json objects : import json jsonstring = json.dumps(data) I would like to iterate over this string to obtain each JSON object as a string. Any suggestions? Thanks in advance. P.S. I have tried the following: for jsonobject in jsonstring: p...

complete xmp/iptc manipulation command line tool or python wrapper? (osx)

hi guys, im searching for a complete command line tool or even better a python wrapper to manipulate and retrieve image metadata. i tried pyexiv2 which is very nice but i cant register a new namespace like 'XMP.imageapp.uuid' (maybe im missing something and i would be glad to hear a solution for that.) with the command line tool exiv2...

Roman representation of integers

Possible Duplicate: How do you find a roman numeral equivalent of an integer I am looking for a simple algorithm (preferably in Python). How to translate a given integer number to a Roman number? string Roman(int Num){...} For example, Roman(1981) must produce "MCMLXXXI". ...

A good way to make Django geolocation aware? - Django/Geolocation

Hi folks, I would like to be able to associate various models (Venues, places, landmarks) with a City/Country. But I am not sure what some good ways of implementing this would be. I'm following a simple route, I have implemented a Country and City model. Whenever a new city or country is mentioned it is automatically created. Unfo...

Advice on designing django model with "exclusive" foreign key relationships

Hi, I want to design a Task model that can be associated to Project Models, another X model, and other Task models. The obvious choice is a foreign key, but I want any particular instance of that Task model to only be associated to only one of those model types, that is, if a Task model has a relationship with a Project model, it cannot ...

How to interface a simple keypad with the computer and mobile using PYTHON?

The problem is that i want to interface my mobile phone with my computer using a keypad in between. The interfacing should be done in Python environment as this would help me in my further work. the things which i need is 1.inteface my computer with the keypad using python 2. interface the same keypad with a mobile phone so that i ca...

Live video stream on server (PC) from images sent by robot through UDP

Hmm. I found this which seems promising: http://sourceforge.net/projects/mjpg-streamer/ Ok. I will try to explain what I am trying to do clearly and in much detail. I have a small humanoid robot with camera and wifi stick (this is the robot). The robot's wifi stick average wifi transfer rate is 1769KB/s. The robot has 500Mhz CPU and...

Properly evaluating double integral in python

Hello. I am trying to compute a definite double integral using scipy. The integrand is a bit complicated, as it contains some probability distributions to give weight to how likely is each value of x and y (like a mixture model). The following code evaluated to a negative number, but it should be bound by [0,1]. Additionally, it took abo...