<html><head></head><body><div>
<meta charset="utf-8">
<div id="compose-body-wrapper" dir="auto"><div dir="auto"><div
dir="auto">Hello,</div><div dir="auto">I'm trying to automate changes in
the projection used by the map canvas. If I open the python console and use
the following command sequence:</div><div dir="auto"><i>
novus_CRS = '+proj=lcc +lat_1=63.0 +lat_2=75.0 +lat_0=70.0
+lon_0=-97.0 +datum=WGS84 +no_defs'</i></div><div dir="auto"><i>
crs =
QgsCoordinateReferenceSystem.fromProj4(novus_CRS)</i></div><div
dir="auto"><i> qgsProject =
QgsProject.instance() </i></div><div dir="auto"><i>
qgsProject.setCrs(crs) </i></div><div dir="auto">This
works fine. However, and when I try to incorporate it programmatically
(e.g. in a plugin), I keep getting the error:</div><div dir="auto"><font
color="#ff0000">Failed to open
/usr/local/share/qgis/resources/data/world_map.gpkg</font></div><div
dir="auto"><br></div><div dir="auto">However, this file seems to be in the
right subdirectory:</div><div dir="auto"><i>$ cd
/usr/local/share/qgis/resources/data</i></div><div
dir="auto"><i>ubuntu@ip-172-31-23-167:/usr/local/share/qgis/resources/data$
ls -l</i></div><div dir="auto"><i>total 12744</i></div><div
dir="auto"><i>-rw-r--r-- 1 root root 2542 Jun
8 2022 README_world_map.md</i></div><div dir="auto"><i>-rw-r--r-- 1
root root 27743 Jun 8 2022
contributors.json</i></div><div dir="auto"><i>-rw-r--r-- 1 root root
17711 Jun 8 2022 contributors.qml</i></div><div
dir="auto"><i>-rw-r--r-- 1 root root 8355 Jun
8 2022 qgis-hackfests.json</i></div><div dir="auto"><i>-rw-r--r-- 1
root root 18507 Jun 8 2022
qgis-hackfests.qml</i></div><div dir="auto"><i>-rw-r--r-- 1 root root
4412 Jun 8 2022 user_groups.qml</i></div><div
dir="auto"><i>-rw-r--r-- 1 root root 8897 Jun
8 2022 user_groups_data.json</i></div><div dir="auto"><i>-rw-r--r-- 1
root root 12914688 Jun 8 2022 world_map.gpkg</i></div><div
dir="auto"><i>-rw-r--r-- 1 root root 25158 Jun 8
2022 world_map_generalize.model3</i></div><div dir="auto">Not sure why of
this behavior discrepancy console vs. programmatically. Thanks.</div><div
dir="auto">AF</div><div><br></div></div></div>
</div></body></html>