Re: kill thread

2008-08-08 Thread bockman
On 8 Ago, 10:03, "Mathieu Prevot" <[EMAIL PROTECTED]> wrote: > 2008/8/8 Miki <[EMAIL PROTECTED]>: > > > Hello, > > >> I have a threading.Thread class with a "for i in range(1,50)" loop > >> within. When it runs and I do ^C, I have the error [1] as many as > >> loops. I would like to catch this exce

Re: undo a dictionary

2008-07-30 Thread bockman
On 30 Lug, 16:51, mmm <[EMAIL PROTECTED]> wrote: > I found code to undo a dictionary association. > > def undict(dd, name_space=globals()): >     for key, value in dd.items(): >         exec "%s = %s" % (key, repr(value)) in name_space > > So if i run > > >>> dx= { 'a':1, 'b': 'B'} > >>> undict(dx)

Re: read file into list of lists

2008-07-11 Thread bockman
On 11 Lug, 15:15, antar2 <[EMAIL PROTECTED]> wrote: > Hello, > > I can not find out how to read a file into a list of lists. I know how > to split a text into a list > > sentences = line.split(\n) > > following text for example should be considered as a list of lists (3 > columns and 3 rows), so th

Re: about python modules

2008-05-21 Thread bockman
On 21 Mag, 14:31, srinivas <[EMAIL PROTECTED]> wrote: > hi friends i am new to python programming. > i am using Python 2.5 and IDLE as editor. > i have developed some functions in python those will be calling > frequently in my main method . > now i want to know how to import my functions folder to

Re: List behaviour

2008-05-15 Thread bockman
On 15 Mag, 12:08, Gabriel <[EMAIL PROTECTED]> wrote: > Hi all > > Just wondering if someone could clarify this behaviour for me, please? > > >>> tasks = [[]]*6 > >>> tasks > > [[], [], [], [], [], []]>>> tasks[0].append(1) > >>> tasks > > [[1], [1], [1], [1], [1], [1]] > > Well what I was expecting

Re: do you fail at FizzBuzz? simple prog test

2008-05-12 Thread bockman
On 12 Mag, 09:00, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 10 May 2008 22:12:37 -0300, globalrev <[EMAIL PROTECTED]> escribió: > > > > > > >http://reddit.com/r/programming/info/18td4/comments > > > claims people take a lot of time to write a simple program like this: > > > "Write a

Re: Question regarding Queue object

2008-04-29 Thread bockman
On 27 Apr, 12:27, Terry <[EMAIL PROTECTED]> wrote: > Hello! > > I'm trying to implement a message queue among threads using Queue. The > message queue has two operations: > PutMsg(id, msg) #  this is simple, just combine the id and msg as one > and put it into the Queue. > WaitMsg(ids, msg) # this

Re: error: (10035, 'The socket operation...

2008-04-28 Thread bockman
On 28 Apr, 01:01, Don Hanlen <[EMAIL PROTECTED]> wrote: > IDLE internal error in runcode() > Traceback (most recent call last): >   File "C:\PYTHON25\lib\idlelib\rpc.py", line 235, in asyncqueue >     self.putmessage((seq, request)) >   File "C:\PYTHON25\lib\idlelib\rpc.py", line 332, in putmessage

Re: How to get inner exception traceback

2008-04-24 Thread bockman
On 24 Apr, 15:00, Christian Heimes <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > : > > > class ReraisedException(Exception): > >     def __init__(self, message, exc_info): > >         Exception.__init__(self, message) > >         self.inner_exception = exc_info > > >  try: > >       try

Re: How to get inner exception traceback

2008-04-24 Thread bockman
On 24 Apr, 13:20, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Hi, > > How can you get the traceback of the inner exception? > > try: >      try: >          import does_not_exit >      except ImportError: >          raise Exception("something wrong") > except: >      ... > > Background: In Django s

Re: Python and stale file handles

2008-04-17 Thread bockman
On 17 Apr, 04:22, tgiles <[EMAIL PROTECTED]> wrote: > Hi, All! > > I started back programming Python again after a hiatus of several > years and run into a sticky problem that I can't seem to fix, > regardless of how hard I try- it it starts with tailing a log file. > > Basically, I'm trying to tai

Re: How is GUI programming in Python?

2008-04-16 Thread bockman
On 11 Apr, 20:19, Rune Strand <[EMAIL PROTECTED]> wrote: > On Apr 10, 3:54 am, Chris Stewart <[EMAIL PROTECTED]> wrote: > ... > > > > > Next, what would you say is the best framework I should look into? > > I'm curious to hear opinions on that. > > GUI-programming in Python is a neanderthal experie

Re: tkinter, event.widget, what do i get?

2008-04-16 Thread bockman
On 16 Apr, 01:45, [EMAIL PROTECTED] wrote: > On 16 Apr, 00:24, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > > > En Tue, 15 Apr 2008 17:45:08 -0300, <[EMAIL PROTECTED]> escribió: > > > > when calling function hmm here, what do i get? the widget i clicked > > > on? > > > if i have a canvs

Re: Python Sockets Help

2008-03-11 Thread bockman
On 10 Mar, 23:58, Mark M Manning <[EMAIL PROTECTED]> wrote: > I need your expertise with a sockets question. > > Let me preface this by saying I don't have much experience with > sockets in general so this question may be simple. > > I am playing with the mini dns server from a script I found > on

Re: draining pipes simultaneously

2008-03-05 Thread bockman
> > Inserting delay in the beginning of the loop causes feeling of command > taking long to start and delay at the end of the loop may cause of > data loss when both thread became inactive during delay. time.sleep() pauses ony the thread that executes it, not the others. And queue objects can hol

Re: draining pipes simultaneously

2008-03-05 Thread bockman
On 5 Mar, 10:33, "Dmitry Teslenko" <[EMAIL PROTECTED]> wrote: > Hello! > Here's my implementation of a function that executes some command and > drains stdout/stderr invoking other functions for every line of > command output: > > def __execute2_drain_pipe(queue, pipe): >         for line in pipe:

Re: Protocol for thread communication

2008-03-05 Thread bockman
On 5 Mar, 06:12, Michael Torrie <[EMAIL PROTECTED]> wrote: > Does anyone have any recommended ideas/ways of implementing a proper > control and status protocol for communicating with threads?  I have a > program that spawns a few worker threads, and I'd like a good, clean way > of communicating the

Re: Import, how to change sys.path on Windows, and module naming?

2008-03-03 Thread bockman
On 3 Mar, 17:12, [EMAIL PROTECTED] wrote: > (unless of course I _did_ miss something and my guess is completely > wrong; I should have done some experiment > before posting, but I'm too lazy for that). > > Ciao > --- > FB- Nascondi testo tra virgolette - > > - Mostra testo tra virgolette - Oo

Re: Import, how to change sys.path on Windows, and module naming?

2008-03-03 Thread bockman
On 1 Mar, 20:17, Steve Holden <[EMAIL PROTECTED]> wrote: > Jeremy Nicoll - news posts wrote: > > > > > Jeremy Nicoll - news posts <[EMAIL PROTECTED]> wrote: > > >> If I understand correctly, when I import something under Windows, Python > >> searches the directory that the executing script was load

Re: Newbie: How can I use a string value for a keyword argument?

2008-02-25 Thread bockman
On 25 Feb, 12:42, Doug Morse <[EMAIL PROTECTED]> wrote: > Hi, > > My apologies for troubling for what is probably an easy question... it's just > that can't seem to find an answer to this anywhere (Googling, pydocs, etc.)... > > I have a class method, MyClass.foo(), that takes keyword arguments.  F

Re: network programming: how does s.accept() work?

2008-02-25 Thread bockman
> > The question I'm really trying to answer is: if a client connects to a > host at a specific port, but the server changes the port when it > creates a new socket with accept(), how does data sent by the client > arrive at the correct port?  Won't the client be sending data to the > original por

Re: network programming: how does s.accept() work?

2008-02-25 Thread bockman
On 25 Feb, 09:51, 7stud <[EMAIL PROTECTED]> wrote: > I have the following two identical clients > > #test1.py:--- > import socket > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > > host = 'localhost' > port = 5052  #server port > > s.connect((host, port)) > print s.getsockname()

Re: Exception on keypress

2008-02-14 Thread bockman
On 14 Feb, 14:27, Michael Goerz <[EMAIL PROTECTED]> wrote: > Hi, > > I'm writing a command line program that watches a file, and recompiles > it when it changes. However, there should also be a possibility of doing > a complete clean restart (cleaning up temp files, compiling some > dependencies, e

Re: Python GUI toolkit

2008-02-04 Thread bockman
> > Another toolkit you might look into is Tkinter. I think it is something > like the "official" toolkit for python. I also think it is an adapter > for other toolkits, so it will use gtk widgets on gnome, qt widgets on > kde and some other strange widgets on windows. > Not t so, AFAIK. Tkinter