From c5ba0fa2c8a9b27073b890c2934c2c7004085a89 Mon Sep 17 00:00:00 2001 From: Alba Mendez Date: Wed, 15 Jul 2020 09:53:02 +0200 Subject: [PATCH 1/2] python 3 bug --- lib/types.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/types.py b/lib/types.py index a9b8d6e..4c315c2 100644 --- a/lib/types.py +++ b/lib/types.py @@ -240,9 +240,8 @@ def parse_enum(self, x, type): def parse_dump(self, file, type): chunk = file.read() filename = self.dump_prefix + str(self.dump_index) - file = open(filename, "w") - file.write(chunk) - file.close() + with open(filename, "wb") as f: + f.write(chunk) self.dump_index += 1 return "%d bytes written to %s" % (len(chunk), filename) From e690c54cfd0fa092d84cf1e2917269c3fab42d7f Mon Sep 17 00:00:00 2001 From: Dillon Korman Date: Sat, 25 Jul 2020 21:47:09 -1000 Subject: [PATCH 2/2] Added dump example I added an example of using dump since I was confused about how to do this at first and it's a useful feature. --- CONFIG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CONFIG.md b/CONFIG.md index 1d1f28d..7df77ce 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -81,6 +81,19 @@ After this, we get: 1 = "STARDUST" 2 = 100 +If you would like to a dump a field to a file, perhaps because it contains bytes that are a file, then use `dump` as follows: + +~~~ python +types = { + "root": { + 1: "dump", + 2: "dump", + }, +} +~~~ + +This dumps field 1 and field 2 to the files `dump.0` and `dump.1`. + Here's the list of native types supported: Wire type | Type | Description