Module for Python and SGE interaction

2011-10-31 Thread Abhishek Pratap
Hey Guys I shud mention I am relative new to the language. Could you please let me know based on your experience which module could help me with farm out jobs to our existing clusters(we use SGE here) using python. Ideally I would like to do the following. 1. Submit #N jobs to cluster 2. monitor

Re: Unicode literals and byte string interpretation.

2011-10-31 Thread Fletcher Johnson
On Oct 28, 3:06 am, Steven D'Aprano wrote: > On Thu, 27 Oct 2011 20:05:13 -0700, Fletcher Johnson wrote: > > If I create a newUnicodeobject u'\x82\xb1\x82\xea\x82\xcd' how does > > this creation process interpret the bytes in the byte string? > > It doesn't, because there is no byte-string. You ha

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Patrick Maupin
On Oct 31, 9:12 pm, Dave Angel wrote: > I would claim that a well-written (in C) translate function, without > using the delete option, should be much quicker than any python loop, > even if it does copy the data. Are you arguing with me? I was agreeing with you, I thought, that translate would

Re: Tweepy: Invalid arguments at function call (tweepy.Stream()) (Terry Reedy)

2011-10-31 Thread Ricardo Mansilla
Thanks a lot for your answer. I'm using python 2.7.2 and tweetpy 1.7 >>> help(tweepy) Help on package tweepy: NAME tweepy - Tweepy Twitter API library (...) VERSION 1.7.1 and probably that is the problem, the link that you gave me refers to the 1.2 version page... Anyway, i already h

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Dave Angel
On 10/31/2011 08:32 PM, Patrick Maupin wrote: On Mon, Oct 31, 2011 at 4:08 PM, Dave Angel wrote: Yes. Actually, you don't even need the split() -- you can pass an optional deletechars parameter to translate(). On Oct 31, 5:52 pm, Ian Kelly wrote: That sounds overly complicated and error-p

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Terry Reedy
On 10/31/2011 7:02 PM, Steven D'Aprano wrote: On Mon, 31 Oct 2011 17:47:06 -0400, Dave Angel wrote: On 10/31/2011 03:54 PM, pyt...@bdurham.com wrote: Wondering if there's a fast/efficient built-in way to determine if a string has non-ASCII chars outside the range ASCII 32-127, CR, LF, or Tab?

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Patrick Maupin
On Mon, Oct 31, 2011 at 4:08 PM, Dave Angel wrote: Yes. Actually, you don't even need the split() -- you can pass an optional deletechars parameter to translate(). On Oct 31, 5:52 pm, Ian Kelly wrote: > That sounds overly complicated and error-prone. Not really. > For instance, split() wil

Re: ttk Listbox

2011-10-31 Thread Kevin Walzer
On 10/31/11 4:03 PM, Ric@rdo wrote: On Mon, 31 Oct 2011 10:00:22 -0400, Kevin Walzer wrote: On 10/31/11 12:37 AM, Ric@rdo wrote: What would be an equivalent widget in ttk like a Listbox and if possible a small example? I tried to look here http://docs.python.org/library/ttk.html but did not s

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Tim Chase
On 10/31/11 18:02, Steven D'Aprano wrote: # Define legal characters: LEGAL = ''.join(chr(n) for n in range(32, 128)) + '\n\r\t\f' # everybody forgets about formfeed... \f # and are you sure you want to include chr(127) as a text char? def is_ascii_text(text): for c in text:

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Terry Reedy
On 10/31/2011 3:54 PM, pyt...@bdurham.com wrote: Wondering if there's a fast/efficient built-in way to determine if a string has non-ASCII chars outside the range ASCII 32-127, CR, LF, or Tab? I presume you also want to disallow the other ascii control chars? I know I can look at the chars of

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Steven D'Aprano
On Mon, 31 Oct 2011 17:47:06 -0400, Dave Angel wrote: > On 10/31/2011 03:54 PM, pyt...@bdurham.com wrote: >> Wondering if there's a fast/efficient built-in way to determine if a >> string has non-ASCII chars outside the range ASCII 32-127, CR, LF, or >> Tab? >> >> I know I can look at the chars of

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Ian Kelly
On Mon, Oct 31, 2011 at 4:08 PM, Dave Angel wrote: > I was wrong once again.  But a simple combination of  translate() and > split() methods might do it.  Here I'm suggesting that the table replace all > valid characters with space, so the split() can use its default behavior. That sounds overly

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Dave Angel
On 10/31/2011 05:47 PM, Dave Angel wrote: On 10/31/2011 03:54 PM, pyt...@bdurham.com wrote: Wondering if there's a fast/efficient built-in way to determine if a string has non-ASCII chars outside the range ASCII 32-127, CR, LF, or Tab? I know I can look at the chars of a string individually and

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Dave Angel
On 10/31/2011 03:54 PM, pyt...@bdurham.com wrote: Wondering if there's a fast/efficient built-in way to determine if a string has non-ASCII chars outside the range ASCII 32-127, CR, LF, or Tab? I know I can look at the chars of a string individually and compare them against a set of legal chars

Re: Tweepy: Invalid arguments at function call (tweepy.Stream())

2011-10-31 Thread Terry Reedy
On 10/31/2011 12:18 PM, Ricardo Mansilla wrote: Hi i'm trying to fetch realtime data from twitter using tweepy.Stream(). A reference to your source for tweepy would help. The link below gives https://github.com/tweepy/tweepy for the current source. http://pypi.python.org/pypi/tweepy/1.7.1 has v

Re: How do I pass a variable to os.popen?

2011-10-31 Thread Paul David Mena
This was exactly what I was looking for. Thanks! On Mon, Oct 31, 2011 at 4:48 PM, Chris Rebert wrote: > On Mon, Oct 31, 2011 at 1:16 PM, extraspecialbitter > wrote: > > I'm trying to write a simple Python script to print out network > > interfaces (as found in the "ifconfig -a" command) and th

Re: How do I pass a variable to os.popen?

2011-10-31 Thread Chris Rebert
On Mon, Oct 31, 2011 at 1:16 PM, extraspecialbitter wrote: > I'm trying to write a simple Python script to print out network > interfaces (as found in the "ifconfig -a" command) and their speed > ("ethtool ").  The idea is to loop for each interface and > print out its speed.  os.popen seems to be

Re: How do I pass a variable to os.popen?

2011-10-31 Thread Dan M
On Mon, 31 Oct 2011 13:16:25 -0700, extraspecialbitter wrote: > cmd = 'ethtool %interface' Do you perhaps mean: cmd = 'ethtool %s' % (interface, ) -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I pass a variable to os.popen?

2011-10-31 Thread J
On Mon, Oct 31, 2011 at 16:16, extraspecialbitter wrote: >    if line[10:20] == "Link encap": >       interface=line[:9] >    cmd = 'ethtool %interface' >    print cmd >    gp = os.popen(cmd) because you're saying that cmd is 'ethtool %interface' as you pointed out later on... how about: cmd =

Re: How do I pass a variable to os.popen?

2011-10-31 Thread Ian Kelly
On Mon, Oct 31, 2011 at 2:16 PM, extraspecialbitter wrote: >    cmd = 'ethtool %interface' That is not Python syntax for string interpolation. Try: cmd = 'ethtool %s' % interface On a side note, os.popen is deprecated. You should look into using the higher-level subprocess.check_output instead

How do I pass a variable to os.popen?

2011-10-31 Thread extraspecialbitter
I'm trying to write a simple Python script to print out network interfaces (as found in the "ifconfig -a" command) and their speed ("ethtool "). The idea is to loop for each interface and print out its speed. os.popen seems to be the right solution for the ifconfig command, but it doesn't seem to

Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread python
Wondering if there's a fast/efficient built-in way to determine if a string has non-ASCII chars outside the range ASCII 32-127, CR, LF, or Tab? I know I can look at the chars of a string individually and compare them against a set of legal chars using standard Python code (and this works fine), bu

Experience with ActivateState Stackato or PiCloud SaaS/PaaS offerings?

2011-10-31 Thread python
Looking for feedback from anyone who has tried or is using ActiveState Stackato, PiCloud or other Python orientated SaaS/PaaS offerings? Pros, cons, advice, lessons learned? Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: C API: Making a context manager

2011-10-31 Thread Chris Kaynor
On Mon, Oct 31, 2011 at 12:15 PM, Brian Curtin wrote: > > You'd just add "__enter__" and "__exit__" in the PyMethodDef. If you > have the CPython source, we do it in there in a few places. Off the > top of my head, PC\winreg.c contains at least one class that works as > a context manager (PyHKEY),

Re: C API: Making a context manager

2011-10-31 Thread Brian Curtin
On Mon, Oct 31, 2011 at 13:34, Chris Kaynor wrote: > I am currently rewritting a class using the Python C API to improve > performance of it, however I have not been able to find any > documentation about how to make a context manager using the C API. > > The code I am working to produce is the fo

Re: ttk Listbox

2011-10-31 Thread Ric
On Mon, 31 Oct 2011 10:00:22 -0400, Kevin Walzer wrote: >On 10/31/11 12:37 AM, Ric@rdo wrote: >> >> What would be an equivalent widget in ttk like a Listbox and if >> possible a small example? I tried to look here >> http://docs.python.org/library/ttk.html but did not see anything. >> >> Maybe I

Re: ttk Listbox

2011-10-31 Thread Ric
On Mon, 31 Oct 2011 10:00:22 -0400, Kevin Walzer wrote: >On 10/31/11 12:37 AM, Ric@rdo wrote: >> >> What would be an equivalent widget in ttk like a Listbox and if >> possible a small example? I tried to look here >> http://docs.python.org/library/ttk.html but did not see anything. >> >> Maybe I

C API: Making a context manager

2011-10-31 Thread Chris Kaynor
I am currently rewritting a class using the Python C API to improve performance of it, however I have not been able to find any documentation about how to make a context manager using the C API. The code I am working to produce is the following (its a method of a class): @contextlib.contextmanage

Tweepy: Invalid arguments at function call (tweepy.Stream())

2011-10-31 Thread Ricardo Mansilla
Hi i'm trying to fetch realtime data from twitter using tweepy.Stream(). So I have tried the following... After successfully authenticate using oauth: auth = tweepy.OAuthHandler(...) (it works fine, i have my access_token.key and secret) i did: streaming_api = tweepy.streaming.Stream(auth, Custom

Re: Review Python site with useful code snippets

2011-10-31 Thread DevPlayer
When visitors visit your site to post their code; often such posts ask for username and email address; consider adding additional fields to generate some Python documenting feature like Sphinx or epydoc. and let your site inject the docstring (module string) into the snippet; primarily, author, u

Re: locate executables for different platforms

2011-10-31 Thread DevPlayer
On Oct 31, 10:00 am, Andrea Crotti wrote: > Suppose that I have a project which (should be)/is multiplatform in python, > which, however, uses some executables as black-boxes. > > These executables are platform-dependent and at the moment they're just > thrown inside the same egg, and using pkg_re

[ANN] Karrigell-4.3.6 released

2011-10-31 Thread Pierre Quentel
Hi, A new version of the Karrigell web framework for Python 3.2+ has just been released on http://code.google.com/p/karrigell/ One of the oldest Python web frameworks around (the first version was released back in 2002), it now has 2 main versions, one for Python 2 and another one for Python 3. T

Re: locate executables for different platforms

2011-10-31 Thread Andrea Crotti
On 10/31/2011 02:00 PM, Andrea Crotti wrote: Suppose that I have a project which (should be)/is multiplatform in python, which, however, uses some executables as black-boxes. These executables are platform-dependent and at the moment they're just thrown inside the same egg, and using pkg_resour

Re: ttk Listbox

2011-10-31 Thread Kevin Walzer
On 10/31/11 12:37 AM, Ric@rdo wrote: What would be an equivalent widget in ttk like a Listbox and if possible a small example? I tried to look here http://docs.python.org/library/ttk.html but did not see anything. Maybe I did not look in the right place? tia The listbox isn't part of the the

locate executables for different platforms

2011-10-31 Thread Andrea Crotti
Suppose that I have a project which (should be)/is multiplatform in python, which, however, uses some executables as black-boxes. These executables are platform-dependent and at the moment they're just thrown inside the same egg, and using pkg_resources to get the path. I would like to rewrite t

Re: How to mix-in __getattr__ after the fact?

2011-10-31 Thread dhyams
Thanks for all of the responses; everyone was exactly correct, and obeying the binding rules for special methods did work in the example above. Unfortunately, I only have read-only access to the class itself (it was a VTK class wrapped with SWIG), so I had to find another way to accomplish what I

Re: ttk Listbox

2011-10-31 Thread autofelge
hi http://www.tkdocs.com/tutorial/index.html remember that you have to import like from tkinter import ttk (at "from tkinter import *" ttk in not included) -- http://mail.python.org/mailman/listinfo/python-list

Re: ttk Listbox

2011-10-31 Thread user1024
hi http://www.tkdocs.com/tutorial/index.html remember that you have to import like from tkinter import ttk (at "from tkinter import *" ttk in not included) -- http://mail.python.org/mailman/listinfo/python-list

Re: ttk Listbox

2011-10-31 Thread autofelge
hi http://www.tkdocs.com/tutorial/index.html remember that you have to import like from tkinter import ttk (at "from tkinter import *" ttk in not included) -- http://mail.python.org/mailman/listinfo/python-list

Re: ttk Listbox

2011-10-31 Thread user1024
hi http://www.tkdocs.com/tutorial/index.html remember that you have to import like from tkinter import ttk (at "from tkinter import *" ttk in not included) -- http://mail.python.org/mailman/listinfo/python-list

Re: ttk Listbox

2011-10-31 Thread user1024
hi http://www.tkdocs.com/tutorial/index.html remember that you have to import line from tkinter import ttk (at "from tkinter import *" ttk in not included) -- http://mail.python.org/mailman/listinfo/python-list

Re: Introducing pickleDB; a simple, lightweight, and fast key-value database.

2011-10-31 Thread Peter Otten
patx wrote: > Hello I have recently started work on a new project called pickleDB. It is > a lightweight key-value database engine (inspired by redis). > > Check it out at http://packages.python.org/pickleDB > > import json as pickle # ;) > > def load(location): > global db > try: >

Re: SSE4a with ctypes in python? (gcc __builtin_popcount)

2011-10-31 Thread Heiko Wundram
Am 31.10.2011 04:13, schrieb est: Is it possible to rewrite the above gcc code in python using ctypes (preferably Win/*nix compatible)? No; the (gcc-injected) functions starting with __builtin_* are not "real" functions in the sense that they can be called by calling into a library, but rathe

SSE4a with ctypes in python? (gcc __builtin_popcount)

2011-10-31 Thread est
Hi guys, Here is the sample code http://stackoverflow.com/questions/6389841/efficiently-find-binary-strings-with-low-hamming-distance-in-large-set/6390606#6390606 static inline int distance(unsigned x, unsigned y) { return __builtin_popcount(x^y); } Is it possible to rewrite the above gcc c

Introducing pickleDB; a simple, lightweight, and fast key-value database.

2011-10-31 Thread patx
Hello I have recently started work on a new project called pickleDB. It is a lightweight key-value database engine (inspired by redis). Check it out at http://packages.python.org/pickleDB -- Harrison Erd -- http://mail.python.org/mailman/listinfo/python-list