mirror of
https://github.com/mvt-project/mvt.git
synced 2026-06-04 05:58:19 +02:00
Set utf-8 as an encoding for open()
Not every system uses 'utf-8' as a default encoding for opening files in Python. Before you say that there must be a way to set default encoding in one line, no, there is not. At least, I didn't found a way to do this.
This commit is contained in:
@@ -41,7 +41,7 @@ def generate_test_stix_file(file_path):
|
||||
res.append(Relationship(i, "indicates", malware))
|
||||
|
||||
bundle = Bundle(objects=res)
|
||||
with open(file_path, "w+") as f:
|
||||
with open(file_path, "w+", encoding="utf-8") as f:
|
||||
f.write(bundle.serialize(pretty=True))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user