1

I'm running the OSGeo4W64 Qgis 3.2.0.

In the gui I can add a vector-layer using the same data as in the example below without any problems. Adding the layer using the python console works too.

When trying to do the same from a stand-alone script I get "ERROR 4: S57 Driver doesn't support update."

Adding other kml files works, but not S57/ENC

Looking in the code where the error is written, it looks like the difference may be the file mode used. I don't want or need to edit, so read-only/update=False is fine.

import os
from qgis.core import *

regi = QgsProviderRegistry.instance('C:\\OSGeo4W64\\apps\\qgis\\plugins')

QgsApplication.setPrefixPath(r'C:\OSGeo4W64\apps\qgis')
app = QgsApplication([],False)
app.initQgis()

l1=QgsVectorLayer(r"D:\ENC_NOAA\All_ENCs\ENC_ROOT\US1AK90M\US1AK90M.000|layername=M_COVR","COVR1","ogr")
print("Valid" if l1.isValid() else "Not Valid")

I have set CPL_DEBUG=ON and the output shows

ERROR 4: S57 Driver doesn't support update.

GDAL: GDALOpen(D:\ENC_NOAA\All_ENCs\ENC_ROOT\US1AK90M\US1AK90M.000, this=0000018CCEB33550) succeeds as S57.

GDAL: GDALClose(D:\ENC_NOAA\All_ENCs\ENC_ROOT\US1AK90M\US1AK90M.000, this=0000018CCEB33550)

Not Valid

Can I control the open mode via the uri?

Why the difference between interactive and stand-alone?

1

set S57_CSV=C:\OSGeo4W64\share\gdal

solves the problem.

I have not figured out where this gets set in the context of running Qgis.

The "ERROR 4: S57 Driver doesn't support update" turned out to be misleading. The data source will be opened in read-only at the next try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.