subprocess выводит None при выполнении скомпилированного скрипта

При выполнении данного скрипта напрямую через интерпретатор он работает без проблем. Если же его скомпилировать то выводится лишь None. До этого была ошибка с кодировкой, но я её смог решить, добавив .decode(encoding="cp866") что следует сделать, чтобы при запуске показывался BSSID Роутера?

import re
import os
import subprocess

# IP address regex
ipRegex = re.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
# MAC address regex
macRegex = re.compile("[0-9a-f]{2}([-:]?)[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$")

""" Get router ip address """
def GetDefaultGateway():
    cmd = "chcp 65001 && ipconfig | findstr /i \"Default Gateway\""
    res = subprocess.check_output(cmd, shell=True, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
    resres = res.decode(encoding='cp866')

    for word in resres.split(' '):
        if word and ipRegex.match(word):
            return word.replace("\n", '')
    
gateway=GetDefaultGateway()

""" Get mac by local ip """
def GetMacByIP():
    z = subprocess.check_output('arp -a', shell=True, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
    a = z.decode(encoding="cp866")
    f = a.find("Physical Address")
    o = a[f:].split(' ')
    for a in o:
        if macRegex.match(a):
            return a.replace('-', ':')

Ответы (0 шт):