MikeWang000000 / Natter

Expose your TCP/UDP port behind full-cone NAT to the Internet.
GNU General Public License v3.0
1.31k stars 107 forks source link

Windows 下 python 通知脚本无法调用 #44

Open onelittlechildawa opened 5 months ago

onelittlechildawa commented 5 months ago

natter.py 第1358行,这里 subprocess.call 直接运行的是 notify_sh,好像在 windows 下无法调用 python 脚本(但是 linux 或者 docker 可以)? 报错 OSError: [WinError 193] %1 不是有效的 Win32 应用程序。

    if   
  notify_sh:
        protocol = "udp" if udp_mode else "tcp"
        inner_ip, inner_port = to_addr if method else natter_addr
        outer_ip, outer_port = outer_addr
        Logger.info("Calling script: %s" % notify_sh)
        subprocess.call([
            os.path.abspath(notify_sh), protocol, str(inner_ip), str(inner_port), str(outer_ip), str(outer_port)
        ], shell=False)
MikeWang000000 commented 5 months ago

Windows 下对应的应该是 .bat 批处理,应该不支持 .py 直接作为可执行程序。

我不常使用 Windows,可以试试将 shell=False 改成 shell=True,看看这样是否能调用 Python 脚本?