Python子进程调用git clone时出现“getaddrinfo() thread failed to start”错误的排查求助
Python子进程调用git clone时出现“getaddrinfo() thread failed to start”错误的排查求助
我在Windows 11系统的PyCharm终端中运行自己的Python代码,代码里通过subprocess.Popen()执行了这条git命令:
git clone -b master --single-branch https://github.com/kivy/python-for-android.git python-for-android
结果执行失败,抛出了如下错误:
Cloning into 'python-for-android'...
fatal: unable to access 'https://github.com/kivy/python-for-android.git/': getaddrinfo() thread failed to start
但诡异的是,我直接在同一个终端里输入这条完全相同的git命令,却能顺利完成克隆操作。
我初步怀疑是网络访问被限制了,查了相关问题后大家都建议检查防火墙。我目前只启用了微软Defender防火墙,尝试把域网络、专用网络和公用网络的防火墙全部关闭(路由器仍在提供防护),但问题并没有得到解决。
而且我已经确认,两种方式调用的是同一个git.exe,按理说就算防火墙处于开启状态,也不该对同一个程序的不同调用场景区别对待啊?
有没有大佬能给点思路,接下来我该从哪些方向排查?到底是什么原因导致git在Python子进程环境下无法正常访问网络呢?
备注:内容来源于stack exchange,提问作者Oddthinking
相关产品推荐
相关产品推荐

