Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import sys
import numpy as np
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
matrix = np.zeros((N,N),dtype=np.int)
for idx, iterator in enumerate(s[1:]):
    W_list = iterator
    for w_idx, w_iterator in enumerate(W_list):
        if w_iterator == "#":
            matrix[idx][w_idx] = 1
ch_matrix = matrix.copy()
w_index_list = np.where(matrix == 0)
b_index_list = np.where(matrix == 1)
max_of_min_dist = 0
for i in range(len(w_index_list[0])):
    min_dist = N * N
    for j in range(len(b_index_list[0])):
        dist = abs(w_index_list[0][i] - b_index_list[0][j]) + abs(w_index_list[1][i] - b_index_list[1][j])
        if min_dist > dist:
            min_dist = dist
    if max_of_min_dist < min_dist:
        max_of_min_dist = min_dist
print(max_of_min_dist)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from scipy import ndimage
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
W_matrix = [list(line.strip()) for line in s[1:N + 1]]
matrix_like_list = [[1 if x == "." else 0 for x in W_list] for W_list in W_matrix]
dist = ndimage.distance_transform_cdt(matrix_like_list, metric="taxicab")
print(dist.max())

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import sys
import numpy as np
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
matrix = np.zeros((N,N),dtype=np.int)
for idx, iterator in enumerate(s[1:]):
    W_list = iterator
    for w_idx, w_iterator in enumerate(W_list):
        if w_iterator == "#":
            matrix[idx][w_idx] = 1
ch_matrix = matrix.copy()
for i in range(N * 2 + 1):
    zero_index_list = np.where(matrix == 0)
    if len(zero_index_list[0]) == 0:
        print(i)
        break
    for i in range(len(zero_index_list[0])):
        row = zero_index_list[0][i]
        col = zero_index_list[1][i]
        bw_checker = 0
        if row != 0:
            bw_checker += matrix[row - 1][col]
        if row != N - 1:
            bw_checker += matrix[row + 1][col]
        if col != 0:
            bw_checker += matrix[row][col - 1]
        if col != W - 1:
            bw_checker += matrix[row][col + 1]
        if bw_checker > 0:
            ch_matrix[row][col] = 1
    matrix = ch_matrix.copy()

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from scipy import ndimage
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
W_matrix = [list(line.strip()) for line in s[1:N + 1]]
matrix_like_list = [[1 if x == "." else 0 for x in W_list] for W_list in W_matrix]
dist = ndimage.distance_transform_cdt(matrix_like_list, metric="taxicab")
print(dist.max())

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import sys
import numpy as np
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
matrix = np.zeros((N,N),dtype=np.int)
for idx, iterator in enumerate(s[1:]):
    W_list = iterator
    for w_idx, w_iterator in enumerate(W_list):
        if w_iterator == "#":
            matrix[idx][w_idx] = 1
ch_matrix = matrix.copy()
for i in range(N * 2):
    zero_index_list = np.where(matrix == 0)
    if len(zero_index_list[0]) == 0:
        print(i)
        break
    for i in range(len(zero_index_list[0])):
        row = zero_index_list[0][i]
        col = zero_index_list[1][i]
        bw_checker = 0
        if row != 0:
            bw_checker += matrix[row - 1][col]
        if row != N - 1:
            bw_checker += matrix[row + 1][col]
        if col != 0:
            bw_checker += matrix[row][col - 1]
        if col != W - 1:
            bw_checker += matrix[row][col + 1]
        if bw_checker > 0:
            ch_matrix[row][col] = 1
    matrix = ch_matrix.copy()

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from scipy import ndimage
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
W_matrix = [list(line.strip()) for line in s[1:N + 1]]
matrix_like_list = [[1 if x == "." else 0 for x in W_list] for W_list in W_matrix]
dist = ndimage.distance_transform_cdt(matrix_like_list, metric="taxicab")
print(dist.max())

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import sys
import numpy as np
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
matrix = np.zeros((N,N),dtype=np.int)
for idx, iterator in enumerate(s[1:]):
    W_list = [x for x in iterator.split()]
    for w_idx in range(W):
        if W == "#":
            matrix[idx, w_idx] = 1
ch_matrix = matrix.copy()
for i in range(N):
    zero_index_list = np.where(matrix == 0)
    if len(zero_index_list[0]) == 0:
        print(i + 1)
        break
    for i in range(len(zero_index_list[0])):
        row = zero_index_list[0][i]
        col = zero_index_list[1][i]
        bw_checker = 0
        if row != 0:
            bw_checker += matrix[row - 1][col]
        if row != N - 1:
            bw_checker += matrix[row + 1][col]
        if col != 0:
            bw_checker += matrix[row][col - 1]
        if col != W - 1:
            bw_checker += matrix[row][col + 1]
        if bw_checker == 1:
            ch_matrix[x][y] = 1
    matrix = ch_matrix.copy()

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from scipy import ndimage
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
W_matrix = [list(line.strip()) for line in s[1:N + 1]]
matrix_like_list = [[1 if x == "." else 0 for x in W_list] for W_list in W_matrix]
dist = ndimage.distance_transform_cdt(matrix_like_list, metric="taxicab")
print(dist.max())