Tagged Questions
11
votes
1answer
96 views
Where is Python's shutdown procedure documented?
CPython has a strange behaviour where it sets modules to None during shutdown. This screws up error logging during shutdown of some multithreading code I've written.
I can't find any documentation of ...
0
votes
1answer
30 views
Calling a thread within a module in python
I have a log in screen which calls a module from a file which is 'HomescreenscrollCopy31' . This works perfectly fine.
The only issue is that there is a thread within the module which does not seem ...
1
vote
0answers
12 views
Apache + mod_wsgi - parallel requests from same browser
could you be so kind and help me with the problem?
I'm running Apache 2.2.22 with mod_wsgi
I configured WSGI properly to work on multiple threads and am using Python
I need to handle parallel ...
0
votes
2answers
60 views
Threading in Python - Have Researched and cant find answer
I have the following script which just isnt working for me :(. I essentially want to create 10 threads to port scan a range of 100 ports. It should seem simple but I dont know where I am going ...
1
vote
1answer
26 views
multithreading in a gui
So this function here is the problem:
def scrape(self):
url = "scrapy crawl myspider -a start_url="
if not self.onionVar.get() and not self.cnnVar.get() and not self.bbcVar.get(): #if no ...
2
votes
1answer
46 views
Threaded Python application does not react on Ctrl+C
I have a simple Python app that runs in two threads. One is SMTP server, the other is HTTP server. When I start it in terminal it does not react on Ctrl+C.
Here is the code:
import asyncore
import ...
2
votes
2answers
47 views
Python threads hang and don't close
This is my first try with threads in Python,
I wrote the following program as a very simple example. It just gets a list and prints it using some threads. However, Whenever there is an error, the ...
0
votes
0answers
18 views
Thread polling sqs and adding it to a python queue for processing dies
I have a piece of multi threaded code - 3 threads that polls data from SQS and add it to a python queue. 5 threads that take the messages from python queue, process them and send it to a back end ...
0
votes
0answers
14 views
How to terminate the thread spawned through thread.start_new_thread()?
I have the following code which starts a new thread on function check. The function check will do something if timer expires after MINS minutes. Is there a way to manually terminate this thread? I ...
0
votes
1answer
37 views
Thread.join() doesn't let the thread itself to update the GUI
I have problem: i call thread.join(), i'm sure the thread is corretcly working by a stdout logging, but it can't update the GUI.
The example is really simple: the thread should update a progressbar ...
0
votes
2answers
33 views
kill threads later a time in python
I have a python code with threads, and i need that if in for example 1 hour the threads are not finished, finish all threads and finish the script, and if the hour are not complete wait that all my ...
-1
votes
1answer
33 views
How to run a python script parallely and efficiently using multithreading/multiprocessing? [on hold]
I have a python script child.py, which is to be called by some other script main.py
For one iteration of execution, child.py takes nearly 400ms
Now I want to execute multiple instances of child.py at ...
0
votes
1answer
28 views
Threaded socket function messing up local variables
I am making a tiny test server in Python, using TCP. The sockets are blocking, but I dont think the sockets are relevant for this question. I know the current solution is a bit ugly and messy but it ...
1
vote
1answer
23 views
Losing Pointer To Thread
Why might the thread pointer disappear?
As you see in the output. The 'obj' key gets deleted
def handle_threads(self):
threads = 0
for key, value in self.work_order.todo_list.items():
...
1
vote
1answer
25 views
Python threading structure [closed]
I read some code like that.
def bind():
while True:
line = raw_input()
#do something
def worker():
print "i'm working"
#do something
th = threading.Thread(target=worker)
...
0
votes
1answer
35 views
From multiprocessing to distributed processing in python standard library
I am studying this code from gitHub about distributed processing. I would like to thank eliben for this nice post. I have read his explanations but there are some dark spots. As far as I understand, ...
-2
votes
1answer
26 views
Can't work out why I'm getting NameError: name 'thread' is not defined
I've downloaded this .py file and I'm trying to get it to run. However, everytime I do I get the following callback error and I'm at a loss to work out what is causing it. I'm running Python 3.4.1 if ...
0
votes
1answer
21 views
how do I read a socket stream dynamically with python
OS: Windows 7
language: Python v3.4
lib: urllib
I retrieve data from a server using a REST protocol. The data comes back as a huge XML string.
At the moment, I wait for all the data to come in, and ...
1
vote
0answers
38 views
C++ & Python: Concurrency, Embedding and Extensions
My project entails the need for a heavily threaded AVL Tree. Obviously this is not possible to do efficiently in Python due to the GIL, but in C++ this is a piece of cake. As the tree will be ...
2
votes
2answers
31 views
Multithreading problems with xmlrpclib.ServerProxy under python 2.7
I have an application which instantiates an xmlrpclib.ServerProxy once, and then passes it to several threads (web application requests), which all perform XML/RPC calls simultaneously. This works ...
0
votes
1answer
42 views
while(1) loop freezes GUI where C# winform attempts to receive strings endlessly over ZMQ from Python script
Objective is click of button should start populating textbox with strings received from python script. In debug stepping I get to see the strings being received in "var message". But by virtue of ...
1
vote
1answer
32 views
Why is my logging messed up (socket, thread, signal)?
The log output of my python program (using the builtin logging module, but occurs even when using simple prints) is partially messed up, as you can see in the following image. Note the first line, ...
3
votes
2answers
40 views
Waking up a specific thread from sleep from another thread in python
I've been chasing my tail on this one for days now, and I'm going crazy. I'm a total amateur and totally new to python, so please excuse my stupidity.
My main thread repeatedly checks a database for ...
0
votes
3answers
39 views
Multi-threading in Python and shell
I have a shell script called "nn.sh" which takes an ip address in a local network and SSH into that ip and then continuously read off some data from that ip and appends the results to a file called ...
-1
votes
1answer
38 views
Closing the multiprocessing after each parallel job
I am using multiprocessing library of python and also emcee which also uses different threads to implement MCMC. The problem is that even when I close the pool still it seems python uses the ...
1
vote
0answers
19 views
Python using threading.Event()
I have two threads that are accessing a web service. One thread is updating a resource and other is possibly getting them.
My webservice class looks below:
class WebServiceHandler(object):
...
0
votes
0answers
20 views
Workerpool not running all threads
I'm doing a rather small example of analysing fastq files. I created a workerpool consisting of a maximum of 30 threads. I then submit a list of 4 fastq files to the workerpool and I see that there ...
0
votes
1answer
19 views
Consuming rabbitmq queue from inside python threads
This is a long one.
I have a list of usernames and passwords. For each one I want to login to the accounts and do something things. I want to use several machines to do this faster. The way I was ...
-1
votes
2answers
21 views
Python - Thread with socket won't stop
I am programming a simple server-based chat program. I am using threads. Everything works fine, but to stop the program, I have to terminate it manually, because the thread, that is searching for new ...
1
vote
2answers
65 views
Use Threads to Talk Interactively with the Python Interpreter
I've made three classes: Reader, Writer and the Main class. The Reader class uses a thread to listen for output from the Python interpreter standard output.
The Reader class:
package main;
import ...
0
votes
3answers
48 views
How to have input while a while loop ( or similar) is executed
I do believe that thread may accomplish this, although I am not sure. Most of the threads out there that address this problem doesn't address it to match my problem. I have created a simple mud-like ...
1
vote
1answer
62 views
Python: Console with infinite loop, getting out of stack space
The implementation is pasted below. However, each time I actually input something in the console, I get this error:
while executing
"::tcl::Bgerror {out of stack space (infinite loop?)} ...
0
votes
1answer
26 views
Python threading.start startup time
I am trying to make a little load testing script that runs a whole stack of operations in parallel but I am finding that the way I am starting threads seems to depend on how much work is in the the ...
0
votes
1answer
22 views
Python Threading and Multiprocessing in the same code causing pickling error
While using Python3 on Windows 7 to process some large csv files I have run into a issue with the program not running fast enough. The original working version of the code is similar to below, but ...
4
votes
1answer
54 views
Python: Getting all the items out of a `threading.local`
I have a threading.local object. When debugging, I want to get all the objects it contains for all threads, while I am only on one of those threads. How can I do that?
1
vote
1answer
30 views
How to handle imaplib2 error
I have a script that checks a gmail account using the imap IDLE protocol. To do this I use imaplib2, hosted here. Every so often it throws an unhandled exception:
Traceback (most recent call last):
...
0
votes
1answer
23 views
Threaded program hangs on Queue.join() when get() and task_done() passed in as callbacks
This script used to have the Queue as a global object that could be accessed where the threads were being instantiated and in the threaded function itself, but to make things cleaner I refactored ...
2
votes
1answer
25 views
Python application multi-threading for dev environment only
I am working on a Python/bottle app that has two components:
A REST endpoint that receives messages and drops them on a queue (in Redis)
A 'worker', which is an infinite loop that polls for messages ...
0
votes
0answers
11 views
Initialization of an APPLICATION which is present in Trash location on mac osx.?
I a making an app in python on mac osx 10.9 mavericks.
I used py2app to convert python file into an app.
In my main app A while running initialize another app B which is placed in resource location ...
0
votes
1answer
42 views
Problems with serial communication and queues
I've some problems creating a multi-process serial logger.
The plan: Having a seperate process reading from serial port, putting data into a queue. The main process reads the entire queue after some ...
0
votes
2answers
90 views
Python simplest form of multiprocessing
Ive been trying to read up on threading and multiprocessing but all the examples are to intricate and advanced for my level of python/programming knowlegde. I want to run a function, which consists of ...
0
votes
1answer
34 views
Using TCP Client to send multiple messages in Python
I have many TCP clients that needs to send multiple messages to a server. On the server side, I wrote:
def listenConnections():
thread_recieve = Thread(target=recieveInstruction)
while(1):
...
0
votes
2answers
23 views
Find a python threads state (whether sleeping or active)
I have a simple requirement, when an event occurs a thread is created and sleeps for x minutes before waking up to carry out its tasks and terminate.
But if another event occurs any thread that is ...
0
votes
4answers
44 views
How to make a multithreaded system work on same dictionary in python
I have a system designed to take data via a socket and store that into a dictionary to serve as a database. Then all my other modules (GUI, analysis, write_to_log_file, etc) will access the database ...
0
votes
0answers
21 views
Python - SQLAlchemy - MySQL - multiple instances work on same data
I have a table in a database, mapped with SQLAlchemy ORM module (I have a "scoped_session" Variable)
I want multiple instances of my program (not just threads, also from several several servers)to be ...
0
votes
1answer
22 views
urwid - output screen for endless loop
I'm trying to make a simple urwid an output screen for an endless loop. It needs to output data coming from another class.
The solution I've found right now is: have a Printer class (a test replacer ...
1
vote
2answers
26 views
Python GIL: concurrent C++ embed
Can python embedded into c++ allow you to run n python scripts concurrently?
I am currently dealing with the dread which is the GIL. My project requires concurrency of at least 2 threads and the easy ...
0
votes
2answers
39 views
Python - is there a threadsafe queue that can be pickled or otherwise serialized to disk?
I'm after a threadsafe queue that can be pickled or serialized to disk. Are there any datastructures in python that do this. The standard python Queue could not be pickled.
0
votes
1answer
22 views
Python MultiThreading. Releasing resources
I am writing super awesome software where i will create a new thread every new minute. This thread will store some data on a remote database server and end. When a new thread is created ...
0
votes
1answer
52 views
Python PyQt: Is it possible to use QThread with a non-GUI program?
I have a Python PyQt application that displays a simple UI.
When the user clicks a button in the UI it triggers a QThread.
The use of a thread prevents the UI from "freezing" while the thread runs.
I ...