mirror of https://github.com/ecmwf/eccodes.git
Python3 support: generated code should use binary mode write
This commit is contained in:
parent
68e23af4d1
commit
e7895cefc4
|
@ -631,7 +631,7 @@ static void header(grib_dumper* d, grib_handle* h)
|
|||
fprintf(self->dumper.out,"import sys\n");
|
||||
fprintf(self->dumper.out,"from eccodes import *\n\n\n");
|
||||
fprintf(self->dumper.out,"def bufr_decode(input_file):\n");
|
||||
fprintf(self->dumper.out," f = open(input_file)\n");
|
||||
fprintf(self->dumper.out," f = open(input_file, 'rb')\n");
|
||||
}
|
||||
fprintf(self->dumper.out," # Message number %ld\n # -----------------\n", d->count);
|
||||
fprintf(self->dumper.out," print ('Decoding message number %ld')\n", d->count);
|
||||
|
|
|
@ -801,9 +801,9 @@ static void footer(grib_dumper* d, grib_handle* h)
|
|||
fprintf(self->dumper.out,"\n # Encode the keys back in the data section\n");
|
||||
fprintf(self->dumper.out," codes_set(ibufr, 'pack', 1)\n\n");
|
||||
if (d->count==1)
|
||||
fprintf(self->dumper.out," outfile = open('outfile.bufr', 'w')\n");
|
||||
fprintf(self->dumper.out," outfile = open('outfile.bufr', 'wb')\n");
|
||||
else
|
||||
fprintf(self->dumper.out," outfile = open('outfile.bufr', 'a')\n");
|
||||
fprintf(self->dumper.out," outfile = open('outfile.bufr', 'ab')\n");
|
||||
|
||||
fprintf(self->dumper.out," codes_write(ibufr, outfile)\n");
|
||||
if (d->count==1)
|
||||
|
|
Loading…
Reference in New Issue