mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 18:52:29 +02:00
Explicitly specify encoding when opening text files in Python code
This commit is contained in:
@@ -96,7 +96,7 @@ def get_block_hashes(settings, max_blocks_per_call=10000):
|
||||
|
||||
def get_rpc_cookie():
|
||||
# Open the cookie file
|
||||
with open(os.path.join(os.path.expanduser(settings['datadir']), '.cookie'), 'r') as f:
|
||||
with open(os.path.join(os.path.expanduser(settings['datadir']), '.cookie'), 'r', encoding="ascii") as f:
|
||||
combined = f.readline()
|
||||
combined_split = combined.split(":")
|
||||
settings['rpcuser'] = combined_split[0]
|
||||
@@ -107,7 +107,7 @@ if __name__ == '__main__':
|
||||
print("Usage: linearize-hashes.py CONFIG-FILE")
|
||||
sys.exit(1)
|
||||
|
||||
f = open(sys.argv[1])
|
||||
f = open(sys.argv[1], encoding="utf8")
|
||||
for line in f:
|
||||
# skip comment lines
|
||||
m = re.search('^\s*#', line)
|
||||
|
||||
Reference in New Issue
Block a user