python

Any dhcp python library?

Is there any library to help me instantiate a dhcp server in python? ...

Adding Values to an Array and getting distinct values using Python

Hello All- I have python code below that will loop through a table and print out values within a particular column. What is not shown is the form in which the user selects a Feature Layer. Once the Feature Layer is selected a second Dropdown is populated with all the Column Headings for that Feature and the user chooses which Column t...

Designing an Python API: Fluent interface or arguments

I'm playing around with a simple port of the Protovis API to Python. Consider the simple bar chart example, in Javascript: var vis = new pv.Panel() .width(150) .height(150); vis.add(pv.Bar) .data([1, 1.2, 1.7, 1.5, .7, .3]) .width(20) .height(function(d) d * 80) .bottom(0) .left(function() this.index * 25...

How to: remove part of a Unicode string in Python following a special character

Hi all first a short summery: python ver: 3.1 system: Linux (Ubuntu) I am trying to do some data retrieval through Python and BeautifulSoup. Unfortunately some of the tables I am trying to process contains cells where the following text string exists: 789.82 ± 10.28 For this i to work i need two things: How do i handle "weird" sym...

How do I setpassword to compressed zip files in Python

I get this error when I try to set a password to a zip file. Below is the code/error I get. Please give me an example of the correct way to do it. This is just the password part of the script... the entire script is to long to post. Code: password = "dog" password = zipfile.setpassword(pwd) Error received when hitting the password...

Ruby use case for nil, equivalent to Python None or JavaScript undefined

How does Ruby's nil manifest in code? For example, in Python you might use None for a default argument when it refers to another argument, but in Ruby you can refer to other arguments in the arg list (see this question). In JS, undefined pops up even more because you can't specify default arguments at all. Can you give an example of how ...

How to deal with IndentationError?

Error Details: File "imp.py", line 55 key = get Key() ^ IndentationError: expected an indented block Below is the Code: # Caesar Cipher MAX_KEY_SIZE = 26 def getMode(): while True: print('Do you wish to encrypt or decrypt or brute force a message?') mode = raw_input().lower() if mode in 'encryp...

combining strings using string substitution - python

hey guys, i want to perform the following operation: b = 'random' c = 'stuff' a = '%s' + '%s' %(b, c) but i get the following error: TypeError: not all arguments converted during string formatting does any one of you know to do so ? ...

Mysterious and weird lines after using uni-form

I'm using django-uni-form to display forms. I've included all the css and javascript (notably jquery) in the page. But now I get some weird looking lines. The image below show how it looks: http://i243.photobucket.com/albums/ff176/cwalkrox/uni-form1.jpg You can notice that for username and email address, the lines are aligned with the ...

Windows platform programming.

I am hired by my local company here which makes small accounting/billing/payroll softwares to manage its clients' companies. Most of them use windows platform and the softwares themselves will not be too complex ones. I want to ask which language should i opt for? Python, C#, VB.net or something else which will make the GUI programming t...

I get a 500 Server Error when I update my OSQA Software

When I updated my OSQA software using svn update it updated but now when I access my website (http://sn50.com) I get a 500 error. How do I fix this? ...

How do I use regular expressions to parse HTML tags?

Hi, Was wondering how I would extrapolate the value of an html element using a regular expression (in python preferably). For example, <a href="http://google.com"&gt; Hello World! </a> What regex would I use to extract Hello World! from the above html? Thanks in advance, James Eggers. ...

blender not responding to my accelerometer motion.

m using arduino to interact the accelerometer MMA7361L with blender2.49.using python 2.62. my arduino code is : void setup() { Serial.begin(9600); } void loop() { Serial.print(analogRead(0)/4, BYTE); //x-axis Serial.print(analogRead(1)/4, BYTE); //y-axis Serial.print(analogRead(2)/4, BYTE); //z-axis delay(40); } my...

Specify Framework Version on OSX

I am compiling a program that embeds Python, in particular Python v3.1. On my system I have several versions of the Python framework: 3.1, 2.5, 2.6. When I pass "-framework Python" to g++ when compiling, g++ seems to pull in version 2.6 (lives at "/System/Library/Frameworks/") instead of version 3.1 (lives at "/Library/Frameworks/"), res...

Automatically setting class member variables in Python

Say, I have the following class in Python class Foo(object): a = None b = None c = None def __init__(self, a = None, b = None, c = None): self.a = a self.b = b self.c = c Is there any way to simplify this process? Whenever I add a new member to class Foo, I'm forced to modify the constructor. ...

custom methods in python urllib2

Using urllib2, are we able to use a method other than 'GET' or 'POST' (when data is provided)? I dug into the library and it seems that the decision to use GET or POST is 'conveniently' tied to whether or not data is provided in the request. For example, I want to interact with a CouchDB database which requires methods such as 'DEL',...

Is there python code to parse a geoPDF file to get the projection and image data? a geoPDF2KML tool?

I want to organize lots of geoPDF files so they can easily viewed overlayed onto Google Maps and Google Earth. My 1st step, I think, is to convert the geoPDF to a jpg type image which then needs matching lat,long information. Is there python code to parse a geoPDF file to get the projection and image data? A geoPDF2KML tool? ...

This code is supposed to get around httperror 304 but it doesn't work

class DefaultErrorHandler(urllib2.HTTPDefaultErrorHandler): 1 def http_error_default(self, req, fp, code, msg, headers): 2 result = urllib2.HTTPError( req.get_full_url(), code, msg, headers, fp) result.status = code 3 return res...

python-opencv webcam ["noneType"]

few weeks ago I tryed to move my mouse pointer using python and opencv ...I didnt had time to do it and today I accidentally found a piece of code doing that my problem is that I cant open my webcam anymore with opencv ... I`m using ubuntu 10.04 ... /dev/video0 is working I can do luvcview -d /dev/video0 but when I say camera = highgui...

How can I open a Python shell at a network path in Windows?

How can I open a Python interpreter at a specific network path in Windows? In the Explorer address bar the path is in UNC form: \\myhost\myshare\.... I can't work out how to change to this directory from the Windows command line, nor in what format I could pass it as an argument to os.chdir. I'm running Python 2.5 on Windows XP. IDLE ...