python-multithreading refers to how to divide work into multiple streams of execution in Python. Usually refers to `threading` module.
0
votes
1answer
10 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 ...
1
vote
0answers
24 views
MySQL: minimizing gaps between AUTO_INCREMENT row IDs
Due to a race condition, and the way that MySQL increments its AUTO_INCREMENT counter, significant gaps are appearing between values of my row ID.
Background: a Python script uses multiple threads to ...
3
votes
0answers
32 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
15 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
69 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 ...
0
votes
1answer
30 views
Not able to access argument inside thread
I have a function which i want to call it in a thread. The code is below. My problems is, when i override the init function i am able to access the argument(all types), but when the control goes to ...
0
votes
0answers
29 views
How to pass arguments to thread in python
I have a function which accepts 4 parameters, 2 of them are string and other 2 are unknown types(Collection class Type and Package Class Type in Enterprise Architect). Now i am able to access the ...
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 ...