Opened 6 years ago

Closed 5 years ago

#7229 closed defect (wontfix)

gdal.TranslateOptions ignores `-of` format args

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

Description

gdal.TranslateOptions appears to silently ignore the -of option given in an array of option strings.

from osgeo import gdal

src_ds = gdal.OpenEx(b'src.tif', gdal.OF_RASTER | gdal.OF_VERBOSE_ERROR | gdal.OF_READONLY)
gdal.Translate(b'out.jp2', src_ds, options=gdal.TranslateOptions([b'-of', b'JP2KAK'])
Error: Failed to load processor shell
No macro or processor named 'shell' found

Interestingly if I pass ["-of", "FROGS"] it _does_ throw an error, so I guess it's validating the option and then ignoring it.

A workaround is to use format kwarg instead, i.e gdal.TranslateOptions([...], format='JP2KAK')

tested on our fork at 86d28efb which is a few months behind upstream trunk, though I can't see any relevant-looking commits in the upstream log.

Change History (5)

comment:1 by Even Rouault, 6 years ago

That works for me with trunk and Python 2.7 and Python 3.5

comment:2 by Even Rouault, 6 years ago

(Forget my deleted comment about PNG, where I forgot to save my modified script... If i change to PNG, that generates a PNG). So status is : works for me

comment:3 by cdestigter, 6 years ago

Thanks Even. I'll update us to upstream trunk and see if I can replicate it there.

comment:4 by Even Rouault, 6 years ago

@cdestigter: any news for this ?

comment:5 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.