Need help on using the USB module

2011-09-18 Thread swarupchandra kamerkar
Hi, I am trying to use Pythoin on windows. I wanted to use the uSB module. I downloaded it and installed it. Still I get the following message. >>> import usb Traceback (most recent call last): File "", line 1, in import usb ImportError: DLL load failed: The specified module

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-18 Thread Chris Angelico
On Mon, Sep 19, 2011 at 3:41 PM, Ian Kelly wrote: > And what if the thread gets killed in the middle of the commit? > Database managers solved this problem years ago. It's not done by preventing death until you're done - death can come from someone brutally pulling out your power cord. There's no

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-18 Thread Adam Jorgensen
The point of the Java thread.stop() being deprecated seems to have very little to do with undeclared exceptions being raised and a lot to do with objects being left in a potentially damaged state. As Ian said, it's a lot more complex than just adding try/catches. Killing a thread in the middle of

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-18 Thread Gregory Ewing
Ian Kelly wrote: And what if the thread gets killed a second time while it's in the except block? And what if the thread gets killed in the middle of the commit? For these kinds of reasons, any feature for raising asynchronous exceptions in another thread would need to come with some relate

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-18 Thread Ian Kelly
On Sat, Sep 17, 2011 at 5:38 PM, Chris Angelico wrote: > But if it's done as an exception, all you need is to > catch that exception and reraise it: > > def threadWork(lock, a1, a2, rate): >   try: >       while True: >               time.sleep(rate) >               lock.lock() >               t =

ANN: Pyro 4.9 released

2011-09-18 Thread Irmen de Jong
Hello, Pyro 4.9 has just been released! Get it from Pypi: http://pypi.python.org/pypi/Pyro4/ Documentation: http://packages.python.org/Pyro4/index.html Changes include: * the documentation has finally been completed * changed asyncresult a little in non-compatible ways. * added more examples:

Re: What is wrong with this code?

2011-09-18 Thread Steven D'Aprano
On Sun, 18 Sep 2011 21:07:22 +, superhappyfuntime wrote: > On 09-15-2011, Ulrich Eckhardt wrote: > >> superhappyfuntime wrote: >>> #this is antiWYSIWYG, an easy to learn cap for begginners to LaTeX. > >> It's LaTeX, not Python. > >> Uli > > no, it's a cap for LaTeX written in python If

Re: What is wrong with this code?

2011-09-18 Thread superhappyfuntime
On 09-15-2011, Ulrich Eckhardt wrote: > superhappyfuntime wrote: >> #this is antiWYSIWYG, an easy to learn cap for begginners to LaTeX. > It's LaTeX, not Python. > Uli no, it's a cap for LaTeX written in python -- I'm trying a new usenet client for Mac, Nemo OS X, since 0 days. You can dow

Re: Numpy.array with dtype works on list of tuples not on list of lists?

2011-09-18 Thread Robert Kern
On 9/18/11 10:55 AM, Alex van der Spek wrote: Why does this not work? dat=[[1,2,3],[4,5,6]] col=[('a','f4'),('b','f4'),('c','f4')] arr=numpy.array(dat,dtype=col) Traceback (most recent call last): File "", line 1, in arr=numpy.array(dat,dtype=col) TypeError: expected a readable buffer object

Re: cause __init__ to return a different class?

2011-09-18 Thread Matthew Pounsett
On Sep 15, 1:54 am, Ryan Kelly wrote: > To be friendlier to others reading your code, I would consider using a > classmethod to create an alternative constructor: I finally got back to looking at this today. As it turns out, un- overriding __new__ in the child class is more complicated than I fi

Re: Numpy.array with dtype works on list of tuples not on list of lists?

2011-09-18 Thread Philip Semanchuk
On Sep 18, 2011, at 11:55 AM, Alex van der Spek wrote: > Why does this not work? > dat=[[1,2,3],[4,5,6]] col=[('a','f4'),('b','f4'),('c','f4')] arr=numpy.array(dat,dtype=col) > > Traceback (most recent call last): > File "", line 1, in > arr=numpy.array(dat,dtype=col) > TypeEr

Re: GTK2.TextView examples

2011-09-18 Thread Chris Angelico
On Mon, Sep 19, 2011 at 3:33 AM, Lance Dillon wrote: > Here are some examples that use GTK2.TextTag. Interestingly, neither runs on my Windows system - I don't have GDK2 or Pango. Much appreciate the examples though - can some of them go into the official docs? It may well be that I'm using comp

Numpy.array with dtype works on list of tuples not on list of lists?

2011-09-18 Thread Alex van der Spek
Why does this not work? dat=[[1,2,3],[4,5,6]] col=[('a','f4'),('b','f4'),('c','f4')] arr=numpy.array(dat,dtype=col) Traceback (most recent call last): File "", line 1, in arr=numpy.array(dat,dtype=col) TypeError: expected a readable buffer object But this does: dat=[(1,2,3),(4,5,6)]

Re: way to calculate 2**1000 without expanding it?

2011-09-18 Thread Arnaud Delobelle
On Sep 18, 2011 1:20 PM, "Mark Dickinson" wrote: > > On Sep 16, 9:17 pm, Arnaud Delobelle wrote: > > Ah go on, let's make a codegolf contest out of it. > > My entry: > > > > >>> sum(map(int,str(2**1000))) > > You could save another character by replacing "2**1000" with "2<<999" > Excellent! --

Re: Cancel or timeout a long running regular expression

2011-09-18 Thread python
Thanks for everyone's comments - much appreciated! Malcolm (the OP) -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a list value from key/value pair

2011-09-18 Thread Kayode Odeyemi
On Sun, Sep 18, 2011 at 11:22 AM, Vincent Vande Vyvre < vincent.vandevy...@swing.be> wrote: > ** > Le 18/09/11 11:39, Kayode Odeyemi a écrit : > > items = {'fees':[('status','pending'), ('timeout',60)], > 'hostel':[('status', > 'pending'), ('timeout','120')]} > > Like that: > > # -*- coding: utf-

Re: way to calculate 2**1000 without expanding it?

2011-09-18 Thread Mark Dickinson
On Sep 16, 9:17 pm, Arnaud Delobelle wrote: > Ah go on, let's make a codegolf contest out of it. > My entry: > > >>> sum(map(int,str(2**1000))) You could save another character by replacing "2**1000" with "2<<999" -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a list value from key/value pair

2011-09-18 Thread Kayode Odeyemi
On Sun, Sep 18, 2011 at 11:25 AM, Vincent Vande Vyvre < vincent.vandevy...@swing.be> wrote: > ** > Le 18/09/11 11:39, Kayode Odeyemi a écrit : > > Hi all, > > > If I have a list with key/value pair, how do I get the value of the key? > > > I'm working with this code snippet: > > >>> items = {'fees

Re: create a directory structure

2011-09-18 Thread Andrea Crotti
On 09/17/2011 12:56 PM, Rafael Durán Castañeda wrote: I think you might want to look at Fabric or vagrant Thanks, but I don't understand how these two project would help me... I don't need to deploy on many machines via s

Re: Getting a list value from key/value pair

2011-09-18 Thread Kayode Odeyemi
On Sun, Sep 18, 2011 at 11:22 AM, Vincent Vande Vyvre < vincent.vandevy...@swing.be> wrote: > ** > Le 18/09/11 11:39, Kayode Odeyemi a écrit : > > items = {'fees':[('status','pending'), ('timeout',60)], > 'hostel':[('status', > 'pending'), ('timeout','120')]} > > Like that: > > # -*- coding: utf-

Re: Getting a list value from key/value pair

2011-09-18 Thread Vincent Vande Vyvre
Le 18/09/11 11:39, Kayode Odeyemi a écrit : Hi all, If I have a list with key/value pair, how do I get the value of the key? I'm working with this code snippet: >>> items = {'fees':[('status','pending'), ('timeout',60)], 'host

Re: Getting a list value from key/value pair

2011-09-18 Thread Vincent Vande Vyvre
Le 18/09/11 11:39, Kayode Odeyemi a écrit : items = {'fees':[('status','pending'), ('timeout',60)], 'hostel':[('status',  'pending'), ('timeout','120')]} Like that: # -*- coding: utf-8 -*- items = {'fees':[('status','pending'), ('timeout',60)],

Re: Getting a list value from key/value pair

2011-09-18 Thread Thomas Jollans
On 18/09/11 11:39, Kayode Odeyemi wrote: > Hi all, > > If I have a list with key/value pair, how do I get the value of the key? > > I'm working with this code snippet: Python 3.2.2 (default, Sep 5 2011, 04:33:58) [GCC 4.6.1 20110819 (prerelease)] on linux2 Type "help", "copyright", "credits" or

Python 2.7.1 64-bit Build on HP-UX11.31 ia64 with aCC - Many modules failed to build

2011-09-18 Thread Wong Wah Meng-R32813
Hello there, I have posted this in Compiler SIG and re-post here in case anyone who knows about this issue is not subscribed to that group. I am working on python build on my server using HP-UX ANSI C Compiler. I want to be consistent using aCC throughout instead of gcc for my python and cx_O

Getting a list value from key/value pair

2011-09-18 Thread Kayode Odeyemi
Hi all, If I have a list with key/value pair, how do I get the value of the key? I'm working with this code snippet: >>> items = {'fees':[('status','pending'), ('timeout',60)], 'hostel':[('status', 'pending'), ('timeout','120')]} >>> print [items[i] for i in items.keys()] [[('status', 'pending'