<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><span style="font-size: 14px;" class="">Hi devs,</span><div class=""><span style="font-size: 14px;" class=""><br class=""></span><div class="">
<div style="text-align: start; text-indent: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">I have  a strange behavior with QgsPathResolver that prevent layer to be loaded if a QgsProject read config file from relative path:</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">The problem has been reduced to the following behavior (pyQgis):</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">```</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""># Init a QgsPathResolver as with a relative path</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">pr = QgsPathResolver('<span style="white-space: pre-wrap;" class="">./geography/data/france_parts.qgs')</span></span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div class=""><span style="font-size: 14px;" class=""><span style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap;" class="">pr.readPath('</span><span style="white-space: pre-wrap;" class="">./france_parts/france_parts.shp')</span></span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""># Output -><b class=""> '<span style="white-space: pre-wrap;" class="">/geography/data/france_parts/france_parts.shp' </span></b></span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="white-space: pre-wrap; font-size: 14px;" class=""># Note the leading '/'</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">```</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">Worst:</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">```</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><div class=""><span style="font-size: 14px;" class="">pr = QgsPathResolver('<span style="white-space: pre-wrap;" class="">../geography/data/france_parts.qgs')</span></span></div><div class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div class=""><span style="font-size: 14px;" class=""><span style="white-space: pre-wrap;" class="">pr.readPath('</span><span style="white-space: pre-wrap;" class="">./france_parts/france_parts.shp')</span></span></div><div class=""><span style="font-size: 14px;" class=""># Output -><b class=""> '<span style="white-space: pre-wrap;" class="">/../geography/data/france_parts/france_parts.shp' </span></b></span></div><div class=""><span style="white-space: pre-wrap; font-size: 14px;" class=""># which is a meaningless path</span></div></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">```</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">The side effect is that if you do:</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">```</span></div><div class=""><div class=""><span style="font-size: 14px;" class="">prj = QgsProject()</span></div><div class=""><span style="font-size: 14px;" class="">prj.read("./geography/data/france_parts.qgs")</span></div></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">```</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">then you get the error:</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">```</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><pre style="box-sizing: border-box; overflow: auto; padding: 1px 0px; margin-top: 0px; margin-bottom: 0px; line-height: inherit; word-break: break-all; word-wrap: break-word; background-color: rgb(255, 221, 221); border: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; white-space: pre-wrap; vertical-align: baseline;" class=""><pre style="box-sizing: border-box; overflow: auto; font-size: 14px; padding: 1px 0px; margin-top: 0px; margin-bottom: 0px; line-height: inherit; word-break: break-all; word-wrap: break-word; border: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; white-space: pre-wrap; vertical-align: baseline;" class=""><font face="Helvetica" class="">Qgis OGR: Cannot open /geography/data/france_parts/france_parts.shp.()
Qgis : 1 unavailable layers found:
Qgis :  * ./france_parts/france_parts.shp</font></pre></pre><div class="">```</div></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">This is with Qgis 3.6.1</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">Can anybody confirm that this behavior is a bug ? I will submit a PR  if this is the case.</span></div><div class=""><span style="font-size: 14px;" class="">Thanks,</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">Cheers</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class="">David</span></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;" class=""><span style="font-size: 14px;" class=""><br class=""></span></div></div></div></div></body></html>