Skip to main content
added 81 characters in body
Source Link
Germán Carrillo
  • 36.6k
  • 5
  • 123
  • 180

You're only missing one line in your script to make it work properly. Namely, you need to set the prefix path for allowing QGIS to initialize data providers. So, right before the qgis.initQgis(), add this line:

qgis.setPrefixPath( qgis_prefix, True )

where qgis_prefix on my Windows machine is "C:/OSGeo4W64/apps/qgis/". On yours, it should be something like "C:/Program Files/QGIS 2.18/apps/qgis/". See this answer for tips on how to know what is your QGIS prefix path.

Once you do that, run your script and you won't obtain the 0 layers loaded message anymore using your project. With no prefix path, QGIS cannot create valid layers from your project, so they apparently aren't loaded.

You're only missing one line in your script to make it work properly. Namely, you need to set the prefix path for allowing QGIS to initialize data providers. So, right before the qgis.initQgis(), add this line:

qgis.setPrefixPath( qgis_prefix, True )

where qgis_prefix on my Windows machine is "C:/OSGeo4W64/apps/qgis/". On yours, it should be something like "C:/Program Files/QGIS 2.18/apps/qgis/". See this answer for tips on how to know what is your QGIS prefix path.

Once you do that, run your script and you won't obtain the 0 layers loaded message anymore using your project. With no prefix path, QGIS cannot create valid layers from your project, so they apparently aren't loaded.

You're only missing one line in your script to make it work properly. Namely, you need to set the prefix path for allowing QGIS to initialize data providers. So, right before the qgis.initQgis(), add this line:

qgis.setPrefixPath( qgis_prefix )

where qgis_prefix on my Windows machine is "C:/OSGeo4W64/apps/qgis/". On yours, it should be something like "C:/Program Files/QGIS 2.18/apps/qgis/". See this answer for tips on how to know what is your QGIS prefix path.

Once you do that, run your script and you won't obtain the 0 layers loaded message anymore using your project. With no prefix path, QGIS cannot create valid layers from your project, so they apparently aren't loaded.

added 81 characters in body
Source Link
Germán Carrillo
  • 36.6k
  • 5
  • 123
  • 180

You're only missing one line in your script to make it work properly. Namely, you need to set the prefix path for allowing QGIS to initialize data providers. So, right before the qgis.initQgis(), add this line:

qgis.setPrefixPath( qgis_prefix, True )

where qgis_prefix on my Windows machine is "C:/OSGeo4W64/apps/qgis/". On yours, it should be something like "C:/Program Files/QGIS 2.18/apps/qgis/". See this answer for tips on how to know what is your QGIS prefix path.

Once you do that, run your script and you won't obtain the 0 layers loaded message anymore using your project. With no prefix path, QGIS cannot create valid layers from your project, so they apparently aren't loaded.

You're only missing one line in your script to make it work properly. Namely, you need to set the prefix path for allowing QGIS to initialize data providers. So, right before the qgis.initQgis(), add this line:

qgis.setPrefixPath( qgis_prefix, True )

where qgis_prefix on my Windows machine is "C:/OSGeo4W64/apps/qgis/". See this answer for tips on how to know what is your QGIS prefix path.

Once you do that, run your script and you won't obtain the 0 layers loaded message anymore using your project. With no prefix path, QGIS cannot create valid layers from your project, so they apparently aren't loaded.

You're only missing one line in your script to make it work properly. Namely, you need to set the prefix path for allowing QGIS to initialize data providers. So, right before the qgis.initQgis(), add this line:

qgis.setPrefixPath( qgis_prefix, True )

where qgis_prefix on my Windows machine is "C:/OSGeo4W64/apps/qgis/". On yours, it should be something like "C:/Program Files/QGIS 2.18/apps/qgis/". See this answer for tips on how to know what is your QGIS prefix path.

Once you do that, run your script and you won't obtain the 0 layers loaded message anymore using your project. With no prefix path, QGIS cannot create valid layers from your project, so they apparently aren't loaded.

Source Link
Germán Carrillo
  • 36.6k
  • 5
  • 123
  • 180

You're only missing one line in your script to make it work properly. Namely, you need to set the prefix path for allowing QGIS to initialize data providers. So, right before the qgis.initQgis(), add this line:

qgis.setPrefixPath( qgis_prefix, True )

where qgis_prefix on my Windows machine is "C:/OSGeo4W64/apps/qgis/". See this answer for tips on how to know what is your QGIS prefix path.

Once you do that, run your script and you won't obtain the 0 layers loaded message anymore using your project. With no prefix path, QGIS cannot create valid layers from your project, so they apparently aren't loaded.