0
votes
2answers
25 views

Using threading/multiprocessing in python to do multiple calculations at the same time

I have a list of numbers. I want to perform some time-consuming operation on each number in the list and make a new list with all the results. Here's a simplified version of what I have: def ...
0
votes
2answers
36 views

Is it possible for 2 processes to access the same list?

Im design a python module that I want to run 2 methods(method1 and method2) in 2 different processes is it possible to have a global list that both processes read and write to? Or will this cause ...
0
votes
0answers
12 views

Destroying a Toplevel in a thread locks up root

I have a program I've been writing that began as a helper function for me to find a certain report on a shared drive based on some information in that report. I decided to give it a GUI so I can ...
0
votes
1answer
19 views

How to launch win32 applications in separate threads in Python

So, I am having this following snippet which attempts to start Microsoft Powerpoint through the win32api: import threading import win32com.client import sys class myDemo(threading.Thread): def ...
3
votes
0answers
33 views

Is this an acceptable way to make threaded SQLAlchemy queries from Twisted?

I've been doing some reading on using SQLAlchemy's ORM in the context of a Twisted application. It's a lot of information to digest, so I'm having a bit of trouble putting all the pieces together. ...
0
votes
2answers
16 views

threading.Thread getting stuck on calling httplib2.Http.request

The first few lines of the script explain the structure and the mechanism. The problem that I'm facing is that the execution is getting stuck at line 53. Once the Downloader acts on the first request ...
1
vote
2answers
71 views

How to thread multiple subprocess instances in Python 2.7?

I have three commands that would otherwise be easily chained together on the command-line like so: $ echo foo | firstCommand - | secondCommand - | thirdCommand - > finalOutput In other words, ...
0
votes
1answer
16 views

Python, can you pass a module level function to ThreadPoolExecutor from within a class

I'm trying to perform multithreading in python and am still trying to get my head around the picklability requirement and how much I can keep my code OOP. Can you run ThreadPoolExecutor from within ...
3
votes
1answer
55 views

How does ThreadPoolExecutor().map differ from ThreadPoolExecutor().submit?

I was just very confused by some code that I wrote. I was surprised to discover that: with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor: results = list(executor.map(f, ...
0
votes
0answers
38 views

Unable to solve Runtime Error with current program logic

Below is my code. It is a port scanner. I have implemented threading to make it much faster. #!/usr/bin/python import socket import sys import threading import optparse from tabulate import tabulate ...
0
votes
2answers
43 views

How to properly execute a non-blocking task with threads in Python

I 've written a small python class which extends 'threading.Thread' and sends an automatic e-mail to myself using the SMTP_SSL module. However in my calling python file it seems that things happen ...
0
votes
1answer
33 views

Python Threading - Creation of a subclass?

I am having a problem wrapping my brain around the reason for creating a subclass when using threading in python. I've read a number of websites including tutorialspoint. The docs say you need to ...
1
vote
2answers
57 views

Why does Python's GIL enforce strict ordering of processing?

from concurrent.futures import ThreadPoolExecutor, as_completed def main(): with ThreadPoolExecutor(max_workers=16) as producersPool: for i in [1,2,3,4,5,6,7,8,9,0]: ...
0
votes
1answer
22 views

python multithreading gives type error

Here is my piece of code, as I am trying to use multithreading unipidA = ['list of data IDs with 6 characters each'] import threading; from time import ctime() def parse_data('give_data_id'): ...
0
votes
2answers
43 views

Storing objects on a Process in python

I would like to store an object on a subclass of multiprocessing.Process as follows: class TestProcess( Process ): def __init__( self, foo ): super( TestProcess, self ).__init__() ...
0
votes
1answer
27 views

changing global variables in threads in python

test_var="TEST" class exLogging(logging.Logger): cmdidDict[threading.currentThread()]="default" def __init__(self, name): logging.Logger.__init__(self, name) ...
0
votes
0answers
41 views

Is it possible to interrupt a blocking read in pyserial?

I am using pyserial to read from a serial port while also checking a stop event so that I can stop listening on that port. The code can be simplified to look like this: import serial import ...
0
votes
2answers
65 views

Timeout on a Python function call inside timeit

I have a function, let's call it my_function(*args, **kwargs), that depending on the arguments passed to it takes anywhere from 30 seconds to many many hours (days). I have a list of different ...
0
votes
0answers
30 views

Confusing output on multithreaded programming

I've wrote this simple program that creates a thread and runs a method: import threading class MyThread(threading.Thread): def __init__(self, thread_name, counter): ...
0
votes
0answers
32 views

Python threading module on windows after session logout

I wrote a code which starts to record screen capture from the second it identifies mouse movement until it identifies the mouse didn't move for a predefined time (10 seconds). In python, on windows, ...
2
votes
2answers
63 views

Python message passing to unique threads

I have an application (actually a plugin for another application) that manages threads to communicate with external sensor devices. The external sensors send events to the application, but the ...
0
votes
1answer
41 views

Python threading: second thread waits until the first one finishes

I'm quite new to Python threading, and still can't make it working properly. I do not understand why, but threads are executed consequently and not in a parallel. Could you please advice, what is ...
0
votes
1answer
38 views

Problems with socketing in IDLE

I'm trying to get a small socket communication set up on my own machine for testing purposes, but I keep getting errors like "[Errno 10053] An established connection was aborted by the software in ...
1
vote
1answer
77 views

Python-Subprocess-Popen Deadlock in a multi-threaded environment

I have following piece of code running inside thread..where 'expand' C executable produces unique string output for each input 'url': p = Popen(["expand", url], bufsize=65536, stdout=PIPE, ...
0
votes
0answers
48 views

Parallel processing in python using threading

I have a program that is supposed to be a web crawler that processes and traverses URLs from separate pages concurrently. When the array of URLs gets too full, the program splits the array into four ...
2
votes
1answer
40 views

determine when a thread is waiting for a lock to release

The lock mechanism (among others) exists to prevent access to shared resources at the same time by different threads. The thread that wants to use the resource is blocked, and must wait for lock to ...
1
vote
1answer
119 views

Expect fails to spawn more than two commands

I have three interactive console applications: controller, node, client. I am unable to handle more than two! The following script produces correct output. spawn controller expect "controller>" ...
0
votes
2answers
32 views

Kill a tcp connection in a separate thread in Python

So here's the problem, I have a small server script in Python that is supposed to accept multiple clients and based on the message they are sending, receiving a certain command back to them. It's a ...
1
vote
1answer
27 views

Is a specific thread inside the threading.enumerate()?

I need to check if an specific thread is inside the results of threading.enumerate(). Let's suppose I get the results with the enumerate: <_MainThread(MainThread, started 8568)> ...
1
vote
1answer
157 views

Python subprocess hangs with named pipes

I’m struggled in trying to emulate this simple piece of bash: # cat /tmp/fifo.tub & [1] 24027 # gunzip -c /tmp/filedat.dat.gz > ...
-1
votes
1answer
62 views

What's the point of giving threads names in Python?

There doesn't appear to be any way to get a thread by using its name so what exactly is the name argument for when you're creating a Thread? I wanted to use it to identify and recover the thread later ...
0
votes
2answers
31 views

Clarification regarding python Pool.map function used for python parallelism

I have a couple of questions regarding the functioning of the following code fragment. def f(x): return x*x if __name__ == '__main__': pool = Pool(processes=10) # start 10 ...
0
votes
1answer
67 views

Execute multi threaded program in Python to run as single thread

I've been using threading class alot in my Python codes and have successfully make a couple routine to run as multi-threaded. The problem is when something fails, it becomes a pain when it comes to ...
0
votes
2answers
65 views

threading in Python taking up too much CPU

I wrote a chat program and have a GUI running using Tkinter, and to go and check when new messages have arrived, I create a new thread so Tkinter keeps doing its thing without locking up while the new ...
0
votes
1answer
54 views

Python _thread Have each thread process the respective number in a sequence

I really don't know to word it much better. I want the first thread to process the first one and the fifth and the ninth, the second would get the second-sixth-tenth,third-seventh,eleventh, and the ...
0
votes
1answer
47 views

Signal the end of jobs on the Queue?

Here's an example code of from Python documentation: def worker(): while True: item = q.get() do_work(item) q.task_done() q = Queue() for i in range(num_worker_threads): ...
0
votes
3answers
188 views

The right way to limit maximum number of threads running at once?

I'd like to create a program that runs multiple light threads, but limits itself to a constant, predefined number of concurrent running tasks, like this (but with no risk of race condition): import ...
1
vote
1answer
91 views

Python Grequests xml responses

Quick question with grequests since the documentation for it is rather sparse. What is the best way to return xml reponse from the request sent? I'm having trouble finding a way to get a response ...
0
votes
0answers
57 views

Jython - Concurrency (Multi Threading Tasks) - Creates Dummy Threads

I run the sample jython program in "http://www.jython.org/jythonbook/en/1.0/Concurrency.html#working-with-tasks" and found the following logs: [Dummy-1] http://www.cnn.com/ download error ...
1
vote
1answer
198 views

python twisted multithreaded server

As I was reading twisted docs on multithreading, I had the impression, that twisted works the best in a single thread, doing all the job asynchronously. But I've got a strong feeling that I don't ...
2
votes
1answer
125 views

How can I do a multithreading twisted python

I have a question that bothers me for a long time, currently I'm working on a daemon which operating requests from outside. Its like a server-client. In this project, I'm using a Twisted Python ...
0
votes
1answer
205 views

run multiple instances of python script simultaneously

I am trying to create 86 instances of task.py to run simultaneously. import sys import subprocess for file in range(86): ...
3
votes
3answers
474 views

Use of threading.Thread.join()

I am new to multithreading in python and trying to learn multithreading using threading module. I have made a very simple program of multi threading and i am having trouble understanding the ...
10
votes
2answers
119 views

cython shared memory in cython.parallel.prange - block

I have a function foo that takes a pointer to memory as argument and both writes and reads to that memory: cdef void foo (double *data): data[some_index_int] = some_value_double ...
2
votes
0answers
69 views

Python - Killing hung function

I am writing a server-backend for a conceptional problem that might be hosted on some CTF challenge. It will be hosted on Ubuntu 12.04 LTS, nginx 1.1.19, and uWSGI 1.0.3-debian which will handle ...
2
votes
0answers
90 views

python Tkinter, threading, and loops

Full disclosure, this is a cross-post from Reddit. Code here. I have a script that I have worked on that is using tkinter to popup some boxes to collect some information from a user. This ...
1
vote
1answer
69 views

Run X Python threads for time period Y

Basically I want to run 400 threads for a fixed period of say 5 minutes. Problem is that I don't know how to put a timer on the treads as a whole (not really familiar to threading). The only way to do ...
0
votes
2answers
44 views

Syntax issue with python dictionary and multiprocessing script

Hi I am trying to be able to start a thread from a dictionary entry using this code below. The rest of the code in the script is known good and fully functional. I cam gonna have to be able to choose ...
0
votes
1answer
136 views

Matplotlib multiProcessing

I am trying to make it so that I can run an infinite loop asking for user input as well as running a matplotlib simple diagram. Any suggestions how this can work? Currently I have for my code: def ...
0
votes
0answers
43 views

Django commands interacting

I have the following situation: I have one django command that is listening to an outside source for information. I don't know how long said stream is, what the format or what the terminating sequence ...

15 30 50 per page