[elbe-devel] [PATCH 1/2] elbepack: egpg: write signed type as bytes

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Apr 29 14:37:08 CEST 2024


The data contained in a Data() object is raw bytes.
Write it as such to the output file.

Avoid the following exception:

Traceback (most recent call last):
  File "/var/cache/elbe/devel/elbe", line 5, in <module>
    main()
  File "/var/cache/elbe/devel/elbepack/main.py", line 44, in main
    cmdmod.run_command(sys.argv[2:])
  File "/var/cache/elbe/devel/elbepack/commands/sign.py", line 14, in run_command
    sign_file(argv[0], argv[1])
  File "/var/cache/elbe/devel/elbepack/egpg.py", line 240, in sign_file
    sign(fname, outfilename, fingerprint)
  File "/var/cache/elbe/devel/elbepack/egpg.py", line 235, in sign
    fd.write(signature)
TypeError: write() argument must be str, not bytes

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/egpg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/egpg.py b/elbepack/egpg.py
index 18eb8ea149ff..f7af65bf9d1d 100644
--- a/elbepack/egpg.py
+++ b/elbepack/egpg.py
@@ -231,7 +231,7 @@ def sign(infile, outfile, fingerprint):
         else:
             outdata.seek(0, os.SEEK_SET)
             signature = outdata.read()
-            with open(outfile, 'w') as fd:
+            with open(outfile, 'wb') as fd:
                 fd.write(signature)
 
 

-- 
2.44.0



More information about the elbe-devel mailing list