<p dir="auto">The Flask Doc Download link mentioned below are broken</p>
<p dir="auto"><a href="http://flask.pocoo.org/docs/flask-docs.pdf" rel="nofollow">http://flask.pocoo.org/docs/flask-docs.pdf</a></p>
<p dir="auto"><a href="http://flask.pocoo.org/docs/flask-docs.zip" rel="nofollow">http://flask.pocoo.org/docs/flask-docs.zip</a></p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">For the server to start correctly, this code used to work before 1.1.2.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from pathlib import Path

ui_dist_dir = Path(__file__).parent / &quot;ui&quot; / &quot;public&quot;
app = Flask(__name__, static_folder=ui_dist_dir, static_url_path=&quot;/static&quot;, template_folder=ui_dist_dir)"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">pathlib</span> <span class="pl-k">import</span> <span class="pl-v">Path</span>

<span class="pl-s1">ui_dist_dir</span> <span class="pl-c1">=</span> <span class="pl-v">Path</span>(<span class="pl-s1">__file__</span>).<span class="pl-s1">parent</span> <span class="pl-c1">/</span> <span class="pl-s">"ui"</span> <span class="pl-c1">/</span> <span class="pl-s">"public"</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-s1">static_folder</span><span class="pl-c1">=</span><span class="pl-s1">ui_dist_dir</span>, <span class="pl-s1">static_url_path</span><span class="pl-c1">=</span><span class="pl-s">"/static"</span>, <span class="pl-s1">template_folder</span><span class="pl-c1">=</span><span class="pl-s1">ui_dist_dir</span>)</pre></div>
<p dir="auto">I'm not sure if it was intended to be used with <code class="notranslate">pathlib</code> before but since python2 support is being dropped I think it would make a lot of sense to support. I would even say that instead of manually replacing slashes in strings, it would be a good idea to use pathlib internally and not duplicate that logic in Flask.</p>
<h3 dir="auto">Actual Behavior</h3>

<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;/opt/spike/server/envs/default/lib/python3.7/runpy.py&quot;, line 193, in _run_module_as_main
    &quot;__main__&quot;, mod_spec)
  File &quot;/opt/spike/server/envs/default/lib/python3.7/runpy.py&quot;, line 85, in _run_code
    exec(code, run_globals)
  File &quot;/opt/spike/server/spike/start.py&quot;, line 140, in &lt;module&gt;
    start()
  File &quot;/opt/spike/server/spike/start.py&quot;, line 64, in start
    app = Flask(__name__, static_folder=ui_dist_dir, static_url_path=&quot;/static&quot;, template_folder=ui_dist_dir)
  File &quot;/opt/spike/server/envs/default/lib/python3.7/site-packages/flask/app.py&quot;, line 420, in __init__
    self.static_folder = static_folder
  File &quot;/opt/spike/server/envs/default/lib/python3.7/site-packages/flask/helpers.py&quot;, line 1004, in static_folder
    value = value.rstrip(&quot;/\\&quot;)
AttributeError: 'PosixPath' object has no attribute 'rstrip'"><pre class="notranslate"><span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"/opt/spike/server/envs/default/lib/python3.7/runpy.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">193</span>, <span class="pl-s1">in</span> <span class="pl-s1">_run_module_as_main</span>
    <span class="pl-s">"__main__"</span>, <span class="pl-s1">mod_spec</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/opt/spike/server/envs/default/lib/python3.7/runpy.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">85</span>, <span class="pl-s1">in</span> <span class="pl-s1">_run_code</span>
    <span class="pl-en">exec</span>(<span class="pl-s1">code</span>, <span class="pl-s1">run_globals</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/opt/spike/server/spike/start.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">140</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-en">start</span>()
  <span class="pl-v">File</span> <span class="pl-s">"/opt/spike/server/spike/start.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">64</span>, <span class="pl-s1">in</span> <span class="pl-s1">start</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-s1">static_folder</span><span class="pl-c1">=</span><span class="pl-s1">ui_dist_dir</span>, <span class="pl-s1">static_url_path</span><span class="pl-c1">=</span><span class="pl-s">"/static"</span>, <span class="pl-s1">template_folder</span><span class="pl-c1">=</span><span class="pl-s1">ui_dist_dir</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/opt/spike/server/envs/default/lib/python3.7/site-packages/flask/app.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">420</span>, <span class="pl-s1">in</span> <span class="pl-s1">__init__</span>
    <span class="pl-s1">self</span>.<span class="pl-s1">static_folder</span> <span class="pl-c1">=</span> <span class="pl-s1">static_folder</span>
  <span class="pl-v">File</span> <span class="pl-s">"/opt/spike/server/envs/default/lib/python3.7/site-packages/flask/helpers.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1004</span>, <span class="pl-s1">in</span> <span class="pl-s1">static_folder</span>
    <span class="pl-s1">value</span> <span class="pl-c1">=</span> <span class="pl-s1">value</span>.<span class="pl-en">rstrip</span>(<span class="pl-s">"/<span class="pl-cce">\\</span>"</span>)
<span class="pl-v">AttributeError</span>: <span class="pl-s">'PosixPath'</span> <span class="pl-s1">object</span> <span class="pl-s1">has</span> <span class="pl-s1">no</span> <span class="pl-s1">attribute</span> <span class="pl-s">'rstrip'</span></pre></div>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Python version: 3.7.4</li>
<li>Flask version: 1.1.2</li>
<li>Werkzeug version: 0.16.1</li>
</ul>