Opened 6 years ago

Closed 5 years ago

#7163 closed enhancement (wontfix)

Python: Any way to clear/reset config options?

Reported by: cdestigter Owned by: hobu
Priority: normal Milestone: closed_because_of_github_migration
Component: PythonBindings Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

We're trying to switch some code from using gdal_translate ... to gdal.Translate().

One obstacle is there doesn't seem to be a way to call gdal.Translate() with a bunch of config options, other than calling gdal.SetConfigOption(), which sets the config options for the entire process forever.

Since this is in a long-running process, I'd prefer not to do that. Or if I do, I'd need a way to reset the config options after calling gdal.Translate().

Something like

gdal.ClearConfigOptions()

An additional thing that would be helpful would be a way to return all currently set config options:

gdal.GetConfigOptions()

If we had either or both of these then it would be trivial to write a state reset function that returned all config options back to a known state. At present I don't see a way to do that.

Change History (2)

comment:1 by Even Rouault, 6 years ago

There's no such methods in Python API. There's a CPLGetConfigOptions() in the C API (port/cpl_conv.cpp). A CPLClearConfigOptions() could be added. And all that bound to SWIG. Patch welcome

comment:2 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.