Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f487423

Browse files
authored
Update hoi4statemapgenerator.py
1 parent a8f9cec commit f487423

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎python3/hoi4statemapgenerator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ def load_definition(name):
147147
try:
148148
with open(name, "r", encoding='utf-8-sig') as f:
149149
lines = f.read().splitlines()
150-
except:
150+
exceptExceptionase:
151151
print("Could not read file " + name + "!")
152+
print(e)
152153
provinces = {}
153154
provinces_rev = {}
154155
for line in lines:
@@ -171,8 +172,9 @@ def load_state_file(name, states_dict):
171172
try:
172173
with open(name, "r", encoding='utf-8-sig') as f:
173174
file_str = f.read()
174-
except:
175+
exceptExceptionase:
175176
print("Could not read file " + name + "!")
177+
print(e)
176178
if not file_str.strip():
177179
return
178180
try:
@@ -289,7 +291,8 @@ def create_states_map_with_id(colors_replacement_dict, provinces_image, water_co
289291
for key, value in state_pixels.items():
290292
state_pixels[key] = (value, font.getsize(str(key)))
291293
print("Generating ID positions...")
292-
positions = p_tqdm.p_map(find_id_position, list(state_pixels.items()), size)
294+
kvps = list(state_pixels.items())
295+
positions = p_tqdm.p_map(find_id_position, kvps, [size]*len(kvps))
293296
for pos, state in positions:
294297
draw.text(pos, str(state), fill="black", font=font)
295298

@@ -299,7 +302,7 @@ def find_id_position(kvp, size):
299302
pixels = kvp[1][0]
300303
font_size = kvp[1][1]
301304
m = None
302-
(X, Y) = size
305+
X, Y = size
303306
m = np.zeros((X, Y))
304307
for pixel in pixels:
305308
m[pixel] = 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /