Re: Problems with imports on multiple threads, with embedded Python

2018-01-04 Thread dieter
geoff.ba...@gmail.com writes: > I have a multithreaded application using an embedded Python 3.6.4 (upgraded > from 3.6.2 today in the hope that the problem was now solved: it doesn't seem > to be). The standard library is in a zip file. So long as only one thread is > running Python at a time i

Re: Problems with imports on multiple threads, with embedded Python

2017-12-21 Thread geoff . bache
On Thursday, 21 December 2017 00:33:54 UTC+1, Lawrence D’Oliveiro wrote: > On Thursday, December 21, 2017 at 5:13:33 AM UTC+13, geoff...@gmail.com wrote: > > > > I have a multithreaded application using an embedded Python 3.6.4 ... > > Avoid multithreading if you can. Is your application CPU-bou

Problems with imports on multiple threads, with embedded Python

2017-12-20 Thread geoff . bache
Hi all, I have a multithreaded application using an embedded Python 3.6.4 (upgraded from 3.6.2 today in the hope that the problem was now solved: it doesn't seem to be). The standard library is in a zip file. So long as only one thread is running Python at a time it seems to work fine. But ther

Re: Multiple Threads - I/O in Same File

2011-11-21 Thread James Matthews
You may have some issues with disk reading as the drive heads move in different ways On Mon, Nov 21, 2011 at 8:15 AM, wrote: > Hi All, > > ** ** > > Just a question in general. Is it possible that we have opened one file > in r+ mode ( file1.txt ). > > We have 2 threads, > > **·

Multiple Threads - I/O in Same File

2011-11-21 Thread Nikunj.Badjatya
Hi All, Just a question in general. Is it possible that we have opened one file in r+ mode ( file1.txt ). We have 2 threads, * Thread1 will continuously 'only read' the file in a loop. * Thread2 will only update the data in the file ( say a number < 100 ). Now thread2 has ca

Re: Multiple threads

2011-11-16 Thread Jack Keegan
On Wed, Nov 16, 2011 at 6:30 PM, Dave Angel wrote: > On 11/16/2011 01:22 PM, Dave Angel wrote: > >> (You're top-posting. Put your remarks AFTER what you're quoting) >> >> On 11/16/2011 12:52 PM, Jack Keegan wrote: >> >>> Ok, I thought that processes would do the same job as threads. So would >>>

Re: Multiple threads

2011-11-16 Thread Miki Tebeka
You can see an example on how to use multiprocessing.Pool at http://pythonwise.blogspot.com/2011/03/convert-oggs-to-mp3-fast-way.html This is ogg -> mp3 but the same idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple threads

2011-11-16 Thread Dave Angel
On 11/16/2011 01:22 PM, Dave Angel wrote: (You're top-posting. Put your remarks AFTER what you're quoting) On 11/16/2011 12:52 PM, Jack Keegan wrote: Ok, I thought that processes would do the same job as threads. So would the general rule be some thing like so: If I want another piece of wor

Re: Multiple threads

2011-11-16 Thread Dave Angel
containers that provide other things (fds, separate address space, etc.). The comment about multiple cores can be extended to multiple threads on a core (CMT) but applies to threads as well as processes. Switching between processes tends to be heavier weight then switching between threads in a process

Re: Multiple threads

2011-11-16 Thread Michael Hunter
other things (fds, separate address space, etc.). The comment about multiple cores can be extended to multiple threads on a core (CMT) but applies to threads as well as processes. Switching between processes tends to be heavier weight then switching between threads in a process because of the n

Re: Multiple threads

2011-11-16 Thread Dave Angel
On 11/16/2011 12:00 PM, Jack Keegan wrote: Hi Chris, On Wed, Nov 16, 2011 at 1:55 PM, Chris Angelico wrote: First off, it's better in CPython (the most popular Python) to use multiple processes than multiple threads. I had been looking into treads and process/subprocess myself a whil

Re: Multiple threads

2011-11-16 Thread Jack Keegan
Hi Chris, On Wed, Nov 16, 2011 at 1:55 PM, Chris Angelico wrote: > First off, it's better in CPython (the most popular Python) to use > multiple processes than multiple threads. I had been looking into treads and process/subprocess myself a while ago and couldn't decide which

Re: Multiple threads

2011-11-16 Thread Thomas Rachel
Am 16.11.2011 14:48 schrieb Eduardo Oliva: Hello, I have a py script that reads for all "m2ts" video files and convert them to "mpeg" using ffmpeg with command line. What I want to do is: I need my script to run 2 separated threads, and then when the first has finished, starts the next one

Re: Multiple threads

2011-11-16 Thread Christian Heimes
Am 16.11.2011 14:48, schrieb Eduardo Oliva: > Hello, I have a py script that reads for all "m2ts" video files and convert > them to "mpeg" using ffmpeg with command line. > > What I want to do is: > > I need my script to run 2 separated threads, and then when the first has > finished, starts

Re: Multiple threads

2011-11-16 Thread Henrik Faber
On 16.11.2011 14:48, Eduardo Oliva wrote: > I need my script to run 2 separated threads, and then when the first has > finished, starts the next onebut no more than 2 threads. > I know that Semaphores would help with that. > But the problem here is to know when the thread has finished i

Re: Multiple threads

2011-11-16 Thread Chris Angelico
27;s better in CPython (the most popular Python) to use multiple processes than multiple threads. That aside, what you're looking at is a pretty common model - a large number of tasks being served by a pool of workers. Have a look at the multiprocessing module, specifically Pool: Version 2: h

Multiple threads

2011-11-16 Thread Eduardo Oliva
Hello, I have a py script that reads for all "m2ts" video files and convert them to "mpeg" using ffmpeg with command line. What I want to do is: I need my script to run 2 separated threads, and then when the first has finished, starts the next onebut no more than 2 threads. I know that

Re: Can PySerial's write method be called by multiple threads?

2010-08-25 Thread Joel Koltner
Hi John, "John Nagle" wrote in message news:4c75768a$0$1608$742ec...@news.sonic.net... You don't need a queue, though; just use your own "write" function with a lock. Hmm... that would certainly work. I suppose it's even more efficient than a queue in that the first thing the queue is

Re: Can PySerial's write method be called by multiple threads?

2010-08-25 Thread John Nagle
On 8/25/2010 11:36 AM, Joel Koltner wrote: I have a multi-threaded application where several of the threads need to write to a serial port that's being handled by pySerial. If pySerial thread-safe in the sense that pySerial.write behaves atomically? I.e., if thread 1 executes, serport.write("Hell

Re: Can PySerial's write method be called by multiple threads?

2010-08-25 Thread Joel Koltner
"Thomas Jollans" wrote in message news:mailman.36.1282762569.29448.python-l...@python.org... I expect that it gives away the GIL to call the resident write() function, to allow other threads to run while it's sitting there, blocking. I haven't looked at the code, so maybe it doesn't hand over t

Re: Can PySerial's write method be called by multiple threads?

2010-08-25 Thread MRAB
On 25/08/2010 19:36, Joel Koltner wrote: I have a multi-threaded application where several of the threads need to write to a serial port that's being handled by pySerial. If pySerial thread-safe in the sense that pySerial.write behaves atomically? I.e., if thread 1 executes, serport.write("Hello,

Re: Can PySerial's write method be called by multiple threads?

2010-08-25 Thread Thomas Jollans
On Wednesday 25 August 2010, it occurred to Joel Koltner to exclaim: > I have a multi-threaded application where several of the threads need to > write to a serial port that's being handled by pySerial. If pySerial > thread-safe in the sense that pySerial.write behaves atomically? I.e., if > thre

Can PySerial's write method be called by multiple threads?

2010-08-25 Thread Joel Koltner
I have a multi-threaded application where several of the threads need to write to a serial port that's being handled by pySerial. If pySerial thread-safe in the sense that pySerial.write behaves atomically? I.e., if thread 1 executes, serport.write("Hello, world!") and thread 2 executes serpor

Re: Logging thread with Queue and multiple threads to log messages

2008-11-10 Thread [EMAIL PROTECTED]
Thank you guys, indeed, calling join() for each thread actually solved the problem. I misunderstood it and call join() right after start() so it didn't work the way I wanted. for i in range(args.threads): children[i].join() -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging thread with Queue and multiple threads to log messages

2008-11-10 Thread Floris Bruynooghe
Hi On Nov 9, 8:28 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I am trying to put up a queue (through a logging thread) so that all > worker threads can ask it to log messages. There is no need to do anything like this, the logging module is thread safe and you can happily just create log

Re: multiple threads with Logging: ValueError: I/O operation on closed file

2008-11-10 Thread Vinay Sajip
On Nov 8, 10:52 pm, [EMAIL PROTECTED] wrote: > OS: Solaris 9 > Python Version: 2.4.4 > > I need to log certain data in a worker thread; however, I am getting > an error now when I use two worker threads. > I think the problem comes from the linelogging.info('Thread Object (%d):(%d), > Time:%s in s

Re: Logging thread with Queue and multiple threads to log messages

2008-11-10 Thread Vinay Sajip
On Nov 9, 8:28 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I am trying to put up a queue (through aloggingthread) so that all > worker threads can ask it to log messages. However, the problem I am > facing is that, well, theloggingthread itself is running forever. > It does not know when

Re: multiple threads with Logging: ValueError: I/O operation on closed file

2008-11-10 Thread Vinay Sajip
On Nov 8, 10:52 pm, [EMAIL PROTECTED] wrote: > OS: Solaris 9 > Python Version: 2.4.4 > > I need to log certain data in a worker thread; however, I am getting > an error now when I use two worker threads. > I think the problem comes from the linelogging.info('Thread Object (%d):(%d), > Time:%s in s

Logging thread with Queue and multiple threads to log messages

2008-11-09 Thread [EMAIL PROTECTED]
I am trying to put up a queue (through a logging thread) so that all worker threads can ask it to log messages. However, the problem I am facing is that, well, the logging thread itself is running forever. It does not know when it should exit. Any suggestion? None of the worker threads knows for

multiple threads with Logging: ValueError: I/O operation on closed file

2008-11-08 Thread scriptlearner
OS: Solaris 9 Python Version: 2.4.4 I need to log certain data in a worker thread; however, I am getting an error now when I use two worker threads. I think the problem comes from the line logging.info('Thread Object (%d):(%d), Time:%s in seconds %d'% (self.no,self.duration,time.ctime(),time.time(

RE: 'Borg' and multiple threads.

2008-01-09 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Tobiah > Sent: Monday, January 07, 2008 5:24 PM > To: python-list@python.org > Subject: 'Borg' and multiple threads. > > I have a class that I call Borg that

Re: 'Borg' and multiple threads.

2008-01-08 Thread Mike Mazur
Hi, On Jan 8, 2008 7:24 AM, Tobiah <[EMAIL PROTECTED]> wrote: > I have a class that I call Borg that starts like this: > > class Borg(dict): > > static_state = {} > def __init__(self): > self.__dict__ = self.static_state > > > so that I can access the same data from

'Borg' and multiple threads.

2008-01-08 Thread Tobiah
I have a class that I call Borg that starts like this: class Borg(dict): static_state = {} def __init__(self): self.__dict__ = self.static_state so that I can access the same data from anywhere within any module or function just by instantiating one. This is use

Creation of multiple threads

2007-11-22 Thread tarun
ent is: I want to have two worker threads and each one notifies the main thread. It could be possible that when a worker thread is running, other might be tirggerd. 1) Can I do with only one Worker thread class? 2) Can there be only one notification function for multiple threads. *CODE:* ** impor

using PyUnit to test with multiple threads

2007-03-28 Thread winston . yang
Is it possible to use PyUnit to test with multiple threads? I want to send many commands to a database at the same time. The order of execution of the commands is indeterminate, and therefore, so is the status message returned. For example, say that I send the commands "get" and &quo

Using multiple threads with pcapy

2005-09-14 Thread billie
Hi all. Because of pcapy sniffng library doesn't permit to listen on multiple interfaces I'm trying to use threads to avoid this problem. In the source below I tried to start a thread for every NIC installed on my system (I got 2 NICs) but once I started the first thread the program can't go fur

Re: Multiple threads in a GUI app (wxPython), communication between worker thread and app?

2005-05-23 Thread Paul Rubin
Jp Calderone <[EMAIL PROTECTED]> writes: > >Secondly, I don't know about wxPython, but in tkinter you have to > >resort to a kludge in order for the gui thread to handle gui events > >and also notice stuff on a queue. There's a tkinter command to run > >some function after a specified time (say 50

Re: Multiple threads in a GUI app (wxPython), communication between worker thread and app?

2005-05-02 Thread Paul Rubin
"fo" <[EMAIL PROTECTED]> writes: > Thanks for the replies. I have a Queue object in the main GUI thread, > this gets passed to all the worker threads and they add items to it. > This is all well and good, but what is a good way to get the GUI thread > to send items back to the worker threads?

Re: Multiple threads in a GUI app (wxPython), communication between worker thread and app?

2005-05-02 Thread fooooo
Thanks for the replies. I have a Queue object in the main GUI thread, this gets passed to all the worker threads and they add items to it. This is all well and good, but what is a good way to get the GUI thread to send items back to the worker threads? -- http://mail.python.org/mailman/listinfo/p

Re: Multiple threads in a GUI app (wxPython), communication between worker thread and app?

2005-05-01 Thread M.E.Farmer
Look inthe demo that comes with wxPython it is in tree process and events -> threads . There is a nice demo of PostEvent(). Another way would be to use Queues as others have mention . You can create a new frame and have it call the queue for data. M.E.Farmer -- http://mail.python.org/mailman/li

Re: Multiple threads in a GUI app (wxPython), communication between worker thread and app?

2005-05-01 Thread John Perks and Sarah Mount
"fo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This is a network app, written in wxPython and the socket module. This > is what I want to happen: I'm not sure if this will help you, but it solved what was, for me, a more general problem: not (normally) being able to issue w

Re: Multiple threads in a GUI app (wxPython), communication between worker thread and app?

2005-05-01 Thread Jp Calderone
On 01 May 2005 10:09:56 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: "fo" <[EMAIL PROTECTED]> writes: How would I get the worker thread to open a GUI window in the main GUI thread? After that GUI window is open, how can I send and recv messages from/to the GUI window? First of all

Re: Multiple threads in a GUI app (wxPython), communication between worker thread and app?

2005-05-01 Thread Paul Rubin
"fo" <[EMAIL PROTECTED]> writes: > How would I get the worker thread to open a GUI window in the main GUI > thread? After that GUI window is open, how can I send and recv messages > from/to the GUI window? First of all the favorite Pythonic way to communicate between threads is with synchroniz

Multiple threads in a GUI app (wxPython), communication between worker thread and app?

2005-05-01 Thread fooooo
This is a network app, written in wxPython and the socket module. This is what I want to happen: GUI app starts. User clicks a button to 'start' the work of the app. When start is pressed, a new thread is spawned (threading module) and this thread starts listening for data on a socket. When someon

Re: pylibpcap and multiple threads

2005-01-25 Thread Örjan Gustavsson
Hi Carlos, I looked in the source code for pylibpcap, and it does not release the GIL, hence my problem. I found a solution though, the pcap object has a fileno member so I could use select to wait for a packet, then call loop without blocking. Problem solved! :) And since it is only a thin wr

Re: pylibpcap and multiple threads

2005-01-24 Thread Carlos Ribeiro
On Mon, 24 Jan 2005 15:18:39 +0100, Örjan Gustavsson <[EMAIL PROTECTED]> wrote: > Hi All! > > Sorry if this is not the correct forum for this kind of question (I did > not find any pylibpcap related lists). > > I am trying to use pylibpcap to capture network traffic from several > ethernet device

pylibpcap and multiple threads

2005-01-24 Thread Örjan Gustavsson
Hi All! Sorry if this is not the correct forum for this kind of question (I did not find any pylibpcap related lists). I am trying to use pylibpcap to capture network traffic from several ethernet devices at the same time, each nic having a separate thread assigned to it. My problem is that wh