<p dir="auto">Please consider generating wheel for faster installs</p>
<p dir="auto"><a href="http://pythonwheels.com/" rel="nofollow">http://pythonwheels.com/</a></p>
<p dir="auto">I'm building a flask app that would benefit from being able to spawn some subprocesses via python's standard multiprocessing module.</p>
<p dir="auto">However, spawning just one leads to an endless loop where an infinite number of processes are spawned. Yikes! It only happens when debug=True is passed to app.run. So it's not a problem in production, but it makes debugging hard.</p>
<p dir="auto">This problem doesn't happen with the threading module, interestingly enough.</p>
<p dir="auto">Code to reproduce (Python version 2.7.3 on Windows 7 x64) follows:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import time
from multiprocessing import Process
from flask import Flask

app = Flask(__name__)

def testFun():
    print 'Starting'
    time.sleep(3)
    print '3 Seconds Later'
backProc = Process(target=testFun, args=())
backProc.start()

@app.route('/')
def root():
    return 'Root'

if __name__ == '__main__':
    app.run(debug=True)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">time</span>
<span class="pl-k">from</span> <span class="pl-s1">multiprocessing</span> <span class="pl-k">import</span> <span class="pl-v">Process</span>
<span class="pl-k">from</span> <span class="pl-s1">flask</span> <span class="pl-k">import</span> <span class="pl-v">Flask</span>

<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">Flask</span>(<span class="pl-s1">__name__</span>)

<span class="pl-k">def</span> <span class="pl-en">testFun</span>():
    <span class="pl-k">print</span> <span class="pl-s">'Starting'</span>
    <span class="pl-s1">time</span>.<span class="pl-en">sleep</span>(<span class="pl-c1">3</span>)
    <span class="pl-k">print</span> <span class="pl-s">'3 Seconds Later'</span>
<span class="pl-s1">backProc</span> <span class="pl-c1">=</span> <span class="pl-v">Process</span>(<span class="pl-s1">target</span><span class="pl-c1">=</span><span class="pl-s1">testFun</span>, <span class="pl-s1">args</span><span class="pl-c1">=</span>())
<span class="pl-s1">backProc</span>.<span class="pl-en">start</span>()

<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-en">route</span>(<span class="pl-s">'/'</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">root</span>():
    <span class="pl-k">return</span> <span class="pl-s">'Root'</span>

<span class="pl-k">if</span> <span class="pl-s1">__name__</span> <span class="pl-c1">==</span> <span class="pl-s">'__main__'</span>:
    <span class="pl-s1">app</span>.<span class="pl-en">run</span>(<span class="pl-s1">debug</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</pre></div>