python

Python 3.0.1 Executable Creator

Does anyone know if there's a windows Python executable creator program available now that supports Python 3.0.1? It seems that py2exe and pyInstaller, along with all the rest I've found, still aren't anywhere close to supporting 3.0 or 3.0.1. Any help is greatly appreciated. Edit: I guess I could downgrade the program to an older vers...

How to limit I/O consumption of Python processes (possibly using ionice)?

I would like a particular set of Python subprocesses to be as low-impact as possible. I'm already using nice to help limit CPU consumption. But ideally I/O would be limited as well. (If skeptical, please humor me and assume there is value in doing this; it doesn't matter how long they take to run, there can be a lot of them, and there...

User editing own Active Directory data

How can I build a web page that allows a logged on user of a Windows 2003 domain change details of his account (probably just First Name, Surname, and Phone number)? ...

How do I generate multi-word terms recursively?

Say I have a string of words: 'a b c d e f'. I want to generate a list of multi-word terms from this string. Word order matters. The term 'f e d' shouldn't be generated from the above example. Edit: Also, words should not be skipped. 'a c', or 'b d f' shouldn't be generated. What I have right now: doc = 'a b c d e f' terms= [] one_...

Is there a better trivial Python WebDAV server code snippet than this?

Does anyone have a better code snippet for a trivial Python WebDAV server? The code below (which is cobbled together from some Google search results) appears to work under Python 2.6, but I wonder if someone has something they have used before, a little more tested and complete. I'd prefer a stdlib-only snippet over a third-party packa...

What's the common practice for enums in Python?

What's the common practice for enums in Python? I.e. how are they replicated in Python? public enum Materials { Shaded, Shiny, Transparent, Matte } ...

Executing Java programs through Python

How do I do this? ...

URL encode a non-value pair in Python

I'm trying to use Google's AJAX (JSON) Web Search API in Python. I'm stuck because Python's urllib.urlencode() only takes value pairs, not strings by themselves, to encode. In Google's API, the query string is the search term and it doesn't associate with a variable. query = "string that needs to be encoded" params = urllib.urlencode(qu...

Using email.HeaderParser with imaplib.fetch in python?

Does anyone have a good example of using the HeaderParser class in Python for a message that you pull down with imaplib.fetch? I have been able to find a lot of related things, but nothing that does just this. Do I need to full down the fetch has an RFC822? I was hoping to simply pull down the subjects. Thanks! ...

Most efficient way of loading formatted binary files in Python

I have binary files no larger than 20Mb in size that have a header section and then a data section containing sequences of uchars. I have Numpy, SciPy, etc. and each library has different ways of loading in the data. Any suggestions for the most efficient methods I should use? ...

Python: an iteration over a non-empty list with no if-clause comes up empty. Why?

How can an iterator over a non-empty sequence, with no filtering and no aggregation (sum(), etc.), yield nothing? Consider a simple example: sequence = ['a', 'b', 'c'] list((el, ord(el)) for el in sequence) This yields [('a', 97), ('b', 98), ('c', 99)] as expected. Now, just swap the ord(el) out for an expression that takes the firs...

Anything like SciPy in Ruby?

Looking further into the differences between Python and Ruby, is there a Ruby equivalent to SciPy, or what other scientific math gems are available for Ruby? ...

How would I compute exactly 30 days into the past with Python (down to the minute)?

In Python, I'm attempting to retrieve the date/time that is exactly 30 days (30*24hrs) into the past. At present, I'm simply doing: >>> import datetime >>> start_date = datetime.date.today() + datetime.timedelta(-30) Which returns a datetime object, but with no time data: >>> start_date.year 2009 >>> start_date.hour Traceback (most r...

Using pydev with Eclipse on OSX

I setup PyDev with this path for the python interpreter /System/Library/Frameworks/Python.framework/Versions/2.5/Python since the one under /usr/bin were alias and Eclipse won't select it. I can run my python script now but cannot run the shell as an external tool. The message I get is variable references empty selection ${resource_loc}...

Can I transpose a file in vim?

I know I can use awk but I am on a windows box I am making a function for others that may not have awk. I also know I can write a C program but I would love not have to create maintain and compile something for a little vim utility I am making. THe original file might be THE DAY WAS LONG THE WAY WAS FAST and it would become TT H...

How can I convert a character to a integer in Python, and viceversa?

I want to get, given a character, its ascii value. For example, for the character 'a', I want to get 97, and viceversa. Thanks, Manuel ...

How do I schedule a process' termination?

I need to run a process, wait a few hours, kill it, and start it again. Is there an easy way that I can accomplish this with Python or Bash? I can run it in the background but how do I identify it to use kill on it? ...

python: finding a missing letter in the alphabet from a list - least lines of code

I'm trying to find the missing letter in the alphabet from the list with the least lines of code. If the list is sorted already (using list.sort()), what is the fastest or least lines of code to find the missing letter. If I know there are only one missing letter. (This is not any type of interview questions. I actually need to do thi...

Using python ctypes to get buffer of floats from shared library into python string

I'm trying to use python ctypes to use these two C functions from a shared library: bool decompress_rgb(unsigned char *data, long dataLen, int scale) float* getRgbBuffer() The first function is working fine. I can tell by putting some debug code in the shared library and checking the input. The problem is getting the data out. The RG...

Does anyone know about workflow frameworks/libraries in Python?

I'm searching for a workflow library/framework for Python. I'm astonished that there I cannot find anything which is simple and not attached to Zope/Plone. Does anyone know of an open-source, simple workflow library/framework. It's preferred to support Django, but not required. ...