python

What is the meaning of error code 24 on Linux?

I'm running a Java program through a Python script on Linux, but the program crashes without outputting any error messages. The os.system command that executes the Java program outputs an error code of 24. What does this mean? ...

Regular expression with [ or ( in python.

I need to extract IP address in the form prosseek.amer.corp.com [10.0.40.147] or prosseek.amer.corp.com (10.0.40.147) with Python. How can I get the IP for either case with Python? I started with something like site = "prosseek.amer.corp.com" m = re.search("%s.*[\(\[](\d+\.\d+\.\d+\.\d+)" % site, r) but it doesn't work. ADDE...

Why are my forms not returning field errors?

Recently I upgraded my django server. Going from 1.2 to a new version. The forms exhibit a strange behavior. When a field is left blank the whole page simply refreshes, rather than showing errors like I remember. What could cause this? What ought I do to fix it? {%extends "baseAUTH.html" %} {% block title %} {{ title }} ...

Facebook stream API error works in Browser but not Server-side

If I enter this URL in a browser it returns to me the valid XML data that I am interested in scraping. http://www.facebook.com/ajax/stream/profile.php?__a=1&profile_id=36343869811&filter=2&max_time=0&try_scroll_load=false&_log_clicktype=Filter%20Stories%20or%20Pagination&ajax_log=0 However, if I do it from the...

Why won't recursive generator work?

Hi all, I have a class where each instance is basically of a bunch of nested lists, each of which holds a number of integers or another list containing integers, or a list of lists, etc., like so: class Foo(list): def __init__(self): self.extend( list(1), list(2), list(3), range(5), [range(3), range(2)] ...

Google app engine QR code decoder

I was wondering if there is a good library for python for decoding QR code. Basically what I would like is to give library image with QR code on it and the library would output contents saved in image. ...

iTunes API for python scripting

Hello everybody, I'm trying to develop some scripts for iTunes in python and actually i'm having quite a hard time getting the API information. I'm using the win32com.client module but i would really need to get all the specifications, methods and details. There are a few examples but I need some extra data...... thanks!!! ...

Web development with ESN Planet, how does it work?

Hello, I'm starting a new job soon, in web-app development. While I'm experienced with programming, my background is primarily in game development and desktop/server applications. I have very little experience from modern web app development. Anyway... Our primary development tool is going to be something called ESN Planet, which I've ...

Wrap a function in python supplying an additional boolean

I'm porting some code from Perl to Python, and one of the functions I am moving does the following: sub _Run($verbose, $cmd, $other_stuff...) { ... } sub Run { _Run(1, @_); } sub RunSilent { _Run(0, @_); } so to do it Python, I naively thought I could do the following: def _Run(verbose, cmd, other_stuff...) ... def Run(*ar...

Making python files executable in Ubuntu

In windows to make one of my codes execute all I have to do is double click on the file. However, I can't seem to figure out how to do a similar task in Ubuntu. ...

Prevent creating new attributes outside __init__

I want to be able to create a class (in Python) that once initialized with __init__, does not accept new attributes, but accepts modifications of existing attributes. There's several hack-ish ways I can see to do this, for example having a __setattr__ method such as def __setattr__(self, attribute, value): if not attribute in self._...

run python command line arguments in shell script

I have a script which takes in few arguments ./hal --runtest=example where example = /home/user/example.py how can I pass these arguments in shell script? ...

How do you calculate the area of a series of random points?

So I'm working on a piece of code to take positional data for a RC Plane Crop Duster and compute the total surface area transversed (without double counting any area). I cannot figure out how to calculate the area for a given period of operation. Given the following Table Calculate the area the points cover. x,y 1,2 1,5 4,3 6,6 3,4 3,...

What does it mean for an object to be picklable (or pickle-able)?

Python docs mention this word a lot and I want to know what it means! Googling doesn't help much.. ...

Good practices in writing code?

I am an engineering student, not computer science though, and have been coding in Matlab for like 4 years. However only recently I have experienced writing long codes, or the need for connection of some multiple codes and data. Writing the code in bits as general functions is one of the things I have experienced lately is a good thing to...

Can python's mechanize use localhost sites?

Can Mechanize access sites being locally hosted by Apache? ...

Can't get GeoRSS to work

Hi, I need to create GeoRSS view in Django but only got error Exception Type: TypeError Exception Value: __init__() got an unexpected keyword argument 'feed_guid' Exception Location: /usr/lib/python2.6/site-packages/django/contrib/syndication/views.py in get_feed, line 117 I red GeoFeed and Syndication in Django docs many...

Start app at startup in mac osx using python3?

An app created with python3 & pyqt needs to be executed on startup. Whenever the app gets executed it has to check whether it has been added to startup list, if not it should be added to the list so that by next time it should be executed on startup. Is there a way to initiate an apple script using python3 or python3 itself to acheive t...

Regular expression matching anything greater than eight letters in length, in Python

Despite attempts to master grep and related GNU software, I haven't come close to mastering regular expressions. I do like them, but I find them a bit of an eyesore all the same. I suppose this question isn't difficult for some, but I've spent hours trying to figure out how to search through my favorite book for words greater than a cer...

Are there an GUI libraries for Python that allow you to compile to an EXE (windows) and APP(Mac)?

I'm working on an application that I need to be cross-platform. I'd like to use Python for it, and am looking for GUI toolkits that make interface programming simple and easy. After a slight hunt, I found PythonCard. This looks like it fits the bill perfectly, but I'm not sure if it will be possible to compile this down to an appropri...