<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 3.*</li>
<li>Operating System / Platform =&gt; Windows x64</li>
</ul>
<h5 dir="auto">Detailed description</h5>

<p dir="auto">In python 3.6.8 using the cv2 library, when using cv2.imwrite as:</p>
<blockquote>
<p dir="auto">cv2.imwrite('path/to/image/myi_image.jpg', my_image)</p>
</blockquote>
<p dir="auto">cv2 does not report an error if the user running the script does not have write permissions to the directory '/path/to/image' as in the above code segment.</p>
<p dir="auto">imwrite just returns false and the error is extremely hard to debug due to no stderr output.</p>
<p dir="auto">In addition, the existence of the directory is also not validated.</p>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 4.2</li>
<li>Operating System / Platform =&gt; Windows 64 Bit</li>
<li>Compiler =&gt;Visual Studio 2015</li>
</ul>
<h5 dir="auto">Detailed description</h5>

<h5 dir="auto">Steps to reproduce</h5>

<p dir="auto">The following is the code i use:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="detection_graph = _load_model(&quot;deploy.prototxt&quot;, &quot;dense121.caffemodel&quot;)
detection_graph.setInput(pre_img, &quot;data&quot;)
out = detection_graph.forward('result')"><pre class="notranslate"><code class="notranslate">detection_graph = _load_model("deploy.prototxt", "dense121.caffemodel")
detection_graph.setInput(pre_img, "data")
out = detection_graph.forward('result')
</code></pre></div>
<p dir="auto">The prototxt of the model:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="layer {
  name: &quot;blstm_input&quot;
  type: &quot;Reshape&quot;
  bottom: &quot;conv5_transpose&quot;
  top: &quot;blstm_input&quot;
  reshape_param {
    shape { dim: -1 }
    axis: 0
    num_axes: 2
  }
}
layer {
	name: &quot;result&quot;
	type: &quot;CTCGreedyDecoder&quot;
	bottom: &quot;blstm_input&quot;
	top: &quot;result&quot;
}"><pre class="notranslate"><code class="notranslate">layer {
  name: "blstm_input"
  type: "Reshape"
  bottom: "conv5_transpose"
  top: "blstm_input"
  reshape_param {
    shape { dim: -1 }
    axis: 0
    num_axes: 2
  }
}
layer {
	name: "result"
	type: "CTCGreedyDecoder"
	bottom: "blstm_input"
	top: "result"
}
</code></pre></div>
<p dir="auto">The error that i ran into:<br>
<code class="notranslate">cv2.error: OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\dnn\src\dnn.cpp:525: error: (-2:Unspecified error) Can't create layer "result" of type "CTCGreedyDecoder" in function 'cv::dnn::dnn4_v20190902::LayerData::getLayerInstance'</code><br>
May i know what is the problem and how can i make it works?</p>