<h3 dir="auto">Expected Behaviour</h3>
<p dir="auto">Body of a 412 response should be included on all Platforms.<br>
(Works on OS X, but not on linux system)</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from flask import Flask
app = Flask(__name__)
@app.route('/')
def r():
    return 'This should be visible\n', 412
app.run('0.0.0.0', port=8080)"><pre class="notranslate"><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-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">r</span>():
    <span class="pl-k">return</span> <span class="pl-s">'This should be visible<span class="pl-cce">\n</span>'</span>, <span class="pl-c1">412</span>
<span class="pl-s1">app</span>.<span class="pl-en">run</span>(<span class="pl-s">'0.0.0.0'</span>, <span class="pl-s1">port</span><span class="pl-c1">=</span><span class="pl-c1">8080</span>)</pre></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="curl localhost:8080

# Expected:
# &gt; 127.0.0.1 - - [03/Jan/2018 17:00:15] &quot;GET / HTTP/1.1&quot; 412 -
# &gt; This should be visible"><pre class="notranslate">curl localhost:8080

<span class="pl-c"><span class="pl-c">#</span> Expected:</span>
<span class="pl-c"><span class="pl-c">#</span> &gt; 127.0.0.1 - - [03/Jan/2018 17:00:15] "GET / HTTP/1.1" 412 -</span>
<span class="pl-c"><span class="pl-c">#</span> &gt; This should be visible</span></pre></div>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">The response does have an empty body if executed on a linux system. (docker-image python)</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="curl localhost:8080

# Actual:
# &gt; 127.0.0.1 - - [03/Jan/2018 17:00:15] &quot;GET / HTTP/1.1&quot; 412 -"><pre class="notranslate">curl localhost:8080

<span class="pl-c"><span class="pl-c">#</span> Actual:</span>
<span class="pl-c"><span class="pl-c">#</span> &gt; 127.0.0.1 - - [03/Jan/2018 17:00:15] "GET / HTTP/1.1" 412 -</span></pre></div>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Python version: 3.6.4</li>
<li>Flask version: 0.12.2</li>
<li>Werkzeug version: 0.14.1</li>
</ul>
<p dir="auto"><strong>Problem:</strong><br>
Creating a custom command for the flask CLI with an import exception is silent, even when running the command, e.g. <code class="notranslate">start</code> with <code class="notranslate">flask start</code> directly.<br>
This makes it difficult to debug import errors in changing environments, as you're left with</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Error: No such command &quot;start&quot;."><pre class="notranslate"><code class="notranslate">Error: No such command "start".
</code></pre></div>
<p dir="auto">without further explanation.</p>
<p dir="auto"><strong>Origin:</strong><br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/pallets/flask/blob/d694eb443a6243e248df974e9cd64defb591bf38/src/flask/cli.py#L541-L546">flask/src/flask/cli.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 541 to 546
      in
      <a data-pjax="true" class="commit-tease-sha" href="/pallets/flask/commit/d694eb443a6243e248df974e9cd64defb591bf38">d694eb4</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L541" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="541"></td>
          <td id="LC541" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">try</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L542" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="542"></td>
          <td id="LC542" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">rv</span> <span class="pl-c1">=</span> <span class="pl-s1">info</span>.<span class="pl-en">load_app</span>().<span class="pl-s1">cli</span>.<span class="pl-en">get_command</span>(<span class="pl-s1">ctx</span>, <span class="pl-s1">name</span>) </td>
        </tr>

        <tr class="border-0">
          <td id="L543" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="543"></td>
          <td id="LC543" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">if</span> <span class="pl-s1">rv</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L544" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="544"></td>
          <td id="LC544" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-k">return</span> <span class="pl-s1">rv</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L545" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="545"></td>
          <td id="LC545" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">except</span> <span class="pl-v">NoAppException</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L546" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="546"></td>
          <td id="LC546" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">pass</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
<code class="notranslate">NoAppException</code> is caught silently with a <code class="notranslate">pass</code>, even though <code class="notranslate">get_command</code> seems to only be used to execute a single command rather than an entire command listing.<br>
However, even the command listing of <code class="notranslate">list_commands</code> explicitly prints the traceback with <code class="notranslate">traceback.print_exc()</code>.<br>
Why that is not done in <code class="notranslate">get_command</code> is not clear to me at this point.<p></p>