Re: Threading problem

2010-04-25 Thread Patrick Maupin
gt; what part of threading in python am I not properly understanding? Unless I'm missing something, your description doesn't make this sound like either a python-specific problem, or a threading problem. Threads run when it's their turn and they aren't blocked, and you haven't

Threading problem

2010-04-25 Thread sdistefano
I have the following issue: My program runs a thread called the MainThread, that loops trough a number of URLs and decides when it's the right time for one to be fetched. Once a URL has to be fetched, it's added to a Queue object, where the FetchingThread picks up and does the actual work. Often,

Re: Threading problem / Paramiko problem ?

2009-12-28 Thread MRAB
mk wrote: Hello everyone, I wrote "concurrent ssh" client using Paramiko, available here: http://python.domeny.com/cssh.py This program has a function for concurrent remote file/dir copying (class SSHThread, method 'sendfile'). One thread per host specified is started for copying (with a wo

Threading problem / Paramiko problem ?

2009-12-28 Thread mk
Hello everyone, I wrote "concurrent ssh" client using Paramiko, available here: http://python.domeny.com/cssh.py This program has a function for concurrent remote file/dir copying (class SSHThread, method 'sendfile'). One thread per host specified is started for copying (with a working queue

Re: Producer-consumer threading problem

2008-06-11 Thread George Sakkis
On Jun 11, 3:07 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 10, 11:33 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > > > I pasted my current solution athttp://codepad.org/FXF2SWmg. Any > > feedback, especially if it has to do with proving or disproving its > > correctness, will be appreciat

Re: Producer-consumer threading problem

2008-06-11 Thread George Sakkis
On Jun 11, 10:13 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 10 Jun 2008 22:46:37 -0700 (PDT), George Sakkis <[EMAIL PROTECTED]> > wrote: > >On Jun 10, 11:47 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > >> I had a little trouble understanding what exact problem it is that you ar

Re: Producer-consumer threading problem

2008-06-11 Thread Aahz
In article <[EMAIL PROTECTED]>, George Sakkis <[EMAIL PROTECTED]> wrote: > >I'd like some feedback on a solution to a variant of the producer- >consumer problem. My first few attempts turned out to deadlock >occasionally; this one seems to be deadlock-free so far but I can't >tell if it's provably

Re: Producer-consumer threading problem

2008-06-11 Thread Carl Banks
On Jun 10, 11:33 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > I pasted my current solution athttp://codepad.org/FXF2SWmg. Any > feedback, especially if it has to do with proving or disproving its > correctness, will be appreciated. It seems like you're reinventing the wheel. The Queue class do

Re: Producer-consumer threading problem

2008-06-11 Thread Rhamphoryncus
On Jun 11, 6:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 11, 1:59 am, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > > > Why not use a normal Queue, put a dummy value (such as None) in when > > you're producer has finished, and have the main thread use the normal > > Thread.join() method o

Re: Producer-consumer threading problem

2008-06-11 Thread Jean-Paul Calderone
On Tue, 10 Jun 2008 22:46:37 -0700 (PDT), George Sakkis <[EMAIL PROTECTED]> wrote: On Jun 10, 11:47 pm, Larry Bates <[EMAIL PROTECTED]> wrote: I had a little trouble understanding what exact problem it is that you are trying to solve but I'm pretty sure that you can do it with one of two metho

Re: Producer-consumer threading problem

2008-06-11 Thread Larry Bates
George Sakkis wrote: On Jun 10, 11:47 pm, Larry Bates <[EMAIL PROTECTED]> wrote: I had a little trouble understanding what exact problem it is that you are trying to solve but I'm pretty sure that you can do it with one of two methods: Ok, let me try again with a different example: I want to d

Re: Producer-consumer threading problem

2008-06-11 Thread giltay
> Sounds like a sentinel would work for this. The producer puts a > specific object (say, None) in the queue and the consumer checks for > this object and stops consuming when it sees it. But that seems so > obvious I suspect there's something else up. There's a decent implementation of thi

Re: Producer-consumer threading problem

2008-06-11 Thread George Sakkis
On Jun 11, 1:59 am, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > Why not use a normal Queue, put a dummy value (such as None) in when > you're producer has finished, and have the main thread use the normal > Thread.join() method on all your child threads? I just gave two reasons: - Concurrency / in

Re: Producer-consumer threading problem

2008-06-10 Thread Carl Banks
On Jun 10, 11:33 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > I'd like some feedback on a solution to a variant of the producer- > consumer problem. My first few attempts turned out to deadlock > occasionally; this one seems to be deadlock-free so far but I can't > tell if it's provably correct,

Re: Producer-consumer threading problem

2008-06-10 Thread Rhamphoryncus
Why not use a normal Queue, put a dummy value (such as None) in when you're producer has finished, and have the main thread use the normal Thread.join() method on all your child threads? -- http://mail.python.org/mailman/listinfo/python-list

Re: Producer-consumer threading problem

2008-06-10 Thread George Sakkis
On Jun 10, 11:47 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > I had a little trouble understanding what exact problem it is that you are > trying to solve but I'm pretty sure that you can do it with one of two > methods: Ok, let me try again with a different example: I want to do what can be ea

Re: Producer-consumer threading problem

2008-06-10 Thread Larry Bates
George Sakkis wrote: I'd like some feedback on a solution to a variant of the producer- consumer problem. My first few attempts turned out to deadlock occasionally; this one seems to be deadlock-free so far but I can't tell if it's provably correct, and if so, whether it can be simplified. The g

Producer-consumer threading problem

2008-06-10 Thread George Sakkis
I'd like some feedback on a solution to a variant of the producer- consumer problem. My first few attempts turned out to deadlock occasionally; this one seems to be deadlock-free so far but I can't tell if it's provably correct, and if so, whether it can be simplified. The generic producer-consume

Re: Multi Threading Problem with Python + Django + PostgreSQL.

2008-03-31 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, Pradip <[EMAIL PROTECTED]> wrote: > Hello every body. I am new to this forum and also in Python. > Read many things about multi threading in python. But still having > problem. > > I am using Django Framework with Python having PostgreSQL as backend > database wi

Multi Threading Problem with Python + Django + PostgreSQL.

2008-03-31 Thread Pradip
Hello every body. I am new to this forum and also in Python. Read many things about multi threading in python. But still having problem. I am using Django Framework with Python having PostgreSQL as backend database with Linux OS. My applications are long running. I am using threading. The problem

Re: threading problem..

2007-10-25 Thread John Nagle
Tried that on Python 2.5 on Windows and it worked. John Nagle Abandoned wrote: > Hi.. > I want to threading but i have a interesting error.. > == > class SelectAll(threading.Thread): >def __init__(self, name): > threading.Thread.__init

Re: threading problem..

2007-10-25 Thread Diez B. Roggisch
Abandoned schrieb: > Hi.. > I want to threading but i have a interesting error.. > == > class SelectAll(threading.Thread): >def __init__(self, name): > threading.Thread.__init__(self) > self.name = name #kelime > >def run(self): > > > self.result=.

threading problem..

2007-10-25 Thread Abandoned
Hi.. I want to threading but i have a interesting error.. == class SelectAll(threading.Thread): def __init__(self, name): threading.Thread.__init__(self) self.name = name #kelime def run(self): self.result=... nglist=[] current = SelectAll(name) ngli

Re: Threading problem when many sockets open

2007-08-25 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Philip Zigoris wrote: > ... and the server > would go into a state where the master thread repeatedly polled the > socket and printed an error. Is that because it cannot create a new socket to accept the connection on? -- http://mail.python.org/mailman/listinfo/py

Threading problem when many sockets open

2007-08-11 Thread Philip Zigoris
Hi all, I have written a socket based service in python and under fairly heavy traffic it performs really well. But i have encountered the following problem: when the system runs out of file descriptors, it seems to stop switching control between threads. Here is some more detail: The system ha

Re: Threading problem

2006-04-18 Thread Diez B. Roggisch
> Here the error message: Exception in thread Thread-1: > Traceback (most recent call last): > File "C:\Program Files\Python\lib\threading.py", line 442, in > __bootstrap > self.run() > File "G:\Robot teleskop\VRT\test\test2.py", line 25, in run > Document.OpenFile('F:/Images/VRT

Re: Threading problem

2006-04-17 Thread Aleksandar Cikota
Thank You, but now it cannot open a file, but it should work... Here the error message: >>> Exception in thread Thread-1: Traceback (most recent call last): File "C:\Program Files\Python\lib\threading.py", line 442, in __bootstrap self.run() File "G:\Robot teleskop\VRT\test\test2.py", line

Re: Threading problem

2006-04-17 Thread Faber
Aleksandar Cikota wrote: > How to integrate the Code-part in the main programm, so that the > mainprogramm works? > > Code: > > import win32com.client > import time > import os > import threading > > Document = win32com.client.Dispatch('MaxIm.Document') > Application = win32com.client.Dispatch(

Threading problem

2006-04-17 Thread Aleksandar Cikota
Hi all,   I have a problem with threading. The following part should be running in a main programm all the time, but so that the main programm also works (like 2 seperate programms, but in one) How to integrate the Code-part in the main programm, so that the mainprogramm works?   Code:   impo

Re: Threading Problem

2004-12-22 Thread Ishwor
On Wed, 22 Dec 2004 12:55:46 +, Alan Kennedy <[EMAIL PROTECTED]> wrote: > [Norbert] > > i am experimenting with threads and get puzzling results. > > Consider the following example: > > # > > import threading, time > > > > def threadfunction(): > > print "threadfunction:

Re: Threading Problem

2004-12-22 Thread Fredrik Lundh
Steve Holden wrote: > Well, I don't believe there's any guarantee that a thread will get run > preference over its > starter - they're both threads, after all. Try putting a sleep after > th.start() and before the > print statement and you should see that the "worker" thread runs while the >

Re: Threading Problem

2004-12-22 Thread Norbert
Thanks Alan, i hoped it would be something trivial :) Norbert -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading Problem

2004-12-22 Thread Norbert
Thanks a lot, Steve, for your fast reply. But the behaviour is the same if 'threadfunction' sleeps longer than just 1 second. 'threadfunction' is of course a dummy to show the problem, imagine a longrunning background-task. If you are right, the question remains 'How can I assure that the starting

Re: Threading Problem

2004-12-22 Thread Alan Kennedy
[Norbert] > i am experimenting with threads and get puzzling results. > Consider the following example: > # > import threading, time > > def threadfunction(): > print "threadfunction: entered" > x = 10 > while x < 40: > time.sleep(1) # time unit is seconds >

Re: Threading Problem

2004-12-22 Thread Steve Holden
Norbert wrote: Hello *, i am experimenting with threads and get puzzling results. Consider the following example: # import threading, time def threadfunction(): .print "threadfunction: entered" .x = 10 .while x < 40: .time.sleep(1) # time unit is seconds

Threading Problem

2004-12-22 Thread Norbert
Hello *, i am experimenting with threads and get puzzling results. Consider the following example: # import threading, time def threadfunction(): print "threadfunction: entered" x = 10 while x < 40: time.sleep(1) # time unit is seconds print "threadf

Re: threading problem

2004-12-10 Thread Egor Bolonev
On Fri, 10 Dec 2004 00:12:16 GMT, Steven Bethard <[EMAIL PROTECTED]> wrote: I think if you change the call to look like: threading.Thread(target=run, args=(os.path.join('c:\\', path),)).start() oh i see now. thanks s='sdgdfgdfg' s == (s) True s == (s,) False -- http://mail.python.org/mailman/li

Re: threading problem

2004-12-09 Thread Steven Bethard
Egor Bolonev wrote: hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' [snip] threading.Thread(target = run, args = (os.path.join('c:\\', path))).start() I believe the args argument to threading.Thread is supposed to b

threading problem

2004-12-09 Thread Egor Bolonev
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program import os, os.path, threading, sys def get_all_files(path): """return all files of folder path, scan with subfolders """ if len(path) >

Re: A little threading problem

2004-12-02 Thread Alban Hertroys
Jeremy Jones wrote: * the get method on a queue object has a "block" flag. You can effectively poll your queues something like this: #untested code #a_done, b_done and c_done are just checks to see if that particular document is done while not (a_done and b_done and c_done): got_a, got_b, go

Re: A little threading problem

2004-12-02 Thread Jeremy Jones
Alban Hertroys wrote: Jeremy Jones wrote: (not waiting, because it already did happen). What is it exactly that you are trying to accomplish? I'm sure there is a better approach. I think I saw at least a bit of the light, reading up on readers and writers (A colleague showed up with a book cal

Re: A little threading problem

2004-12-02 Thread Alban Hertroys
Jeremy Jones wrote: (not waiting, because it already did happen). What is it exactly that you are trying to accomplish? I'm sure there is a better approach. I think I saw at least a bit of the light, reading up on readers and writers (A colleague showed up with a book called "Operating system

Re: A little threading problem

2004-12-02 Thread Alban Hertroys
Jeremy Jones wrote: Alban Hertroys wrote: Notify is called before thread B (in this case) hits the condAllowed.wait() piece of code. So, it sits at that wait() for forever (because it doesn't get notified, because the notification already happened), waiting to be notified from the main thread,

Re: A little threading problem

2004-12-01 Thread Jeremy Jones
Alban Hertroys wrote: Hello all, I need your wisdom again. I'm working on a multi-threaded application that handles multiple data sources in small batches each time. The idea is that there are 3 threads that run simultaneously, each read a fixed number of records, and then they wait for e

A little threading problem

2004-12-01 Thread Alban Hertroys
Hello all, I need your wisdom again. I'm working on a multi-threaded application that handles multiple data sources in small batches each time. The idea is that there are 3 threads that run simultaneously, each read a fixed number of records, and then they wait for eachother. After that the main