Tagged Questions
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
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
30 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 ...
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
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 ...
1
vote
1answer
61 views
Performance goes bad for range based query on cassandra wide column family when implemented using multithreaded pycassa xget() calls?
I have a typical wide column family with {rowkey--> uuid4+date and timeseries data as columns}, on which I have implemented a range based query using pycassa xget() calls. Not that I was plagued with ...
0
votes
0answers
80 views
QDialog.show() doesn't work because of thread suspension
I'm writing a program with a window (ImageWindow(QDialog)) that displays an image which requires a relatively long time to be generated. Because of this, when the program starts, it starts a thread ...
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 ...
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 ...
0
votes
2answers
47 views
python thread weird behavior
I have a timer function which I am calling it in another function like this
import time
import threading
def f():
while(True):
print "hello"
time.sleep(5)
def execute():
t = ...
0
votes
1answer
190 views
Will multiprocessing.Process() or multiprocessing.Pool() distribute more evenly across cores?
Is there any difference at all (in any way) between creating a pool of processes, or simply looping over a process to create more processes?
What's the difference between this?:
pool = ...
1
vote
1answer
80 views
python multiprocessing.Queue.get() prints None at unwanted moments
I have a piece of python code that listens for messages sent by a child process. The message can either be a normal string that is printed directly to a console window, or a tuple with an exception ...
3
votes
1answer
42 views
Threading/Multiprocessing in Python
I have the following code:
import SimpleHTTPServer
import SocketServer
def http_server():
PORT = 80
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = ...
1
vote
1answer
480 views
python: understanding multiprocessing for a simple for loop
I have never used multiprocessing module before.
Is there a way a for loop could be made into concurrent subprocesses. like
for i in xrange(10): list.append(i)
instead of sequential, make it ...
0
votes
1answer
108 views
Python, running a subprocess and read output and not hanging the program
First post here and I must say I'm kinda amateur with programming in general...
I'm using python 2.7.5 subprocess module on osx to read to output of an utility called dns-sd.
The goal is to find out ...
0
votes
2answers
1k views
How terminate Python thread without checking flag continuously
class My_Thread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
print "Starting " + self.name
cmd = [ "bash", 'process.sh']
...
2
votes
2answers
220 views
What does dummy_threading do?
When would I use dummy_threading?
I had thought it might replace system-level threads with mock threads in case system-level threads weren't available for Python.
But when I run this:
import ...
0
votes
0answers
77 views
Scheduling simultaneous events with a defined time range (Advanced Python Scheduler?)
So here's setup, I have an object, let's call it X, that is polled every 500ms (somewhat irrelevant) now say I have 2 other objects, we'll call them s1 and s2, that watch different values that X is ...
4
votes
0answers
316 views
Python Popen on Windows with multithreading - can't delete stdout/stderr logs
Using python 2.7.4 on Windows (Note: WinXP - a commenter below suggests this works correctly on Win7), I have a script that creates several
threads each of which runs a child process via Popen with ...
0
votes
2answers
609 views
running script multiple times simultaniously in python 2.7
Hello I am trying to run a script multiple times but would like this to take place at the same time from what I understood i was to use subprocess and threading together
however when i run it it ...
0
votes
0answers
66 views
python multiprocessing or thread for invoking BlobReader
I have the following setup:
def alpha(self, blah, blah):
image = self.get_image(blob_key)
# do more stuff here
def get_image(self, blob_key):
blob_reader = blobstore.BlobReader(blob_key)
...
0
votes
2answers
39 views
2 digit argument for args in Thread() do not work
Here I have the relevant code snippets for my question:
from threading import Thread
.
.
.
def do_post(thread_no):
print "Starting thread no: " + thread_no + "\n"
.
.
.
for i in ...
1
vote
2answers
201 views
Python functions don't behave as expected when called from threaded class
I am trying to write a game using the new Minecraft Pi Edition API for Python 2.7. I had the game almost finished, when I realised that there where two sections of the code blocking each other. If I ...
2
votes
2answers
717 views
Python Thread Communication Solution
I'm writing a very basic multi-threaded web crawler written in Python, and using a While loop for the function that crawls a page and extract urls, as follows:
def crawl():
while True:
...
0
votes
1answer
222 views
Python multiprocessing hangs
I am starting to learn multiprocessing in python, but have arrived to a point where my code just hangs. It is simply computing 1 000 000 factorial, using multithreading.
import multiprocessing
def ...
4
votes
2answers
1k views
Python multiprocessing: TypeError: expected string or Unicode object, NoneType found
I am attempting to download a whole ftp directory in parallel.
#!/usr/bin/python
import sys
import datetime
import os
from multiprocessing import Process, Pool
from ftplib import FTP
curYear=""
...
0
votes
2answers
364 views
Do threading (socket listening) in python with Quickly
I'm making an application with socket listening with python. I have used Quickly by canonical (which use glade with gi.repository to make gui). But I can't create thread to listening function anyhow. ...
2
votes
3answers
400 views
How to find running time of a thread in Python
I have a multi-threaded SMTP server. Each thread takes care of one client. I need to set a timeout value of 10 seconds on each server thread to terminate dormant or misbehaving clients.
I have used ...
1
vote
1answer
105 views
Strange python queue behavior. Crashes if queue isn't named “queue”
The name kind of says it all. I'm writing this program in python 2.7, and I'm trying to take advantage of threaded queues to make a whole bunch of web requests. Here's the problem: I would like to ...
3
votes
1answer
172 views
Python-Multithreading Time Sensitive Task
from random import randrange
from time import sleep
#import thread
from threading import Thread
from Queue import Queue
'''The idea is that there is a Seeker method that would search a location
for ...
1
vote
2answers
154 views
Returning data to the original process that invoke a subprocess
Someone told me to post this as a new question. This is a follow up to
Instantiating a new WX Python GUI from spawn thread
I implemented the following code to a script that gets called from a ...
2
votes
1answer
322 views
“Release unlocked lock” error in Google App Engine python 2.7 with threadsafe=No
I am seeing a "release unlocked lock" error appear occasionally in the logs for my app on Google App Engine (gqueues) and cannot figure out why (complete stack trace below). Does anyone know why this ...
6
votes
3answers
337 views
Parallelism in python isn't working right
I was developing an app on gae using python 2.7, an ajax call requests some data from an API, a single request could take ~200 ms, however when I open two browsers and make two requests at a very ...