My Python code calls subprocess.Popen()
with a command:
git clone -b master --single-branch https://github.com/kivy/python-for-android.git python-for-android
I call my Python code from the command line Terminal within PyCharm, on Windows 11.
It fails to run getaddrinfo():
Cloning into 'python-for-android'...
fatal: unable to access 'https://github.com/kivy/python-for-android.git/': getaddrinfo() thread failed to start
I run the exact same command directly in the same terminal, and it runs perfectly.
Hmmm... That sounds like it can't get network access... and the answers to this related question all agree to check the firewall.
I only have Microsoft Defender Firewall, and I tried turning off all of the Domain network, Private Network and Public Network firewalls. (My router is still protecting me.) It makes no difference.
I would have thought the firewall, even if it were on, would be paying attention to git.exe
(I have confirmed they are finding the same exe.) and wouldn't trigger on one and not the other.
Where should I look next? Any clues what might be blocking git from accessing the network when running in a Python subprocess?
The subprocess did not contain the environment variable SystemRoot
(which typically points to C:\WINDOWS
).
If you run git
without that environment variable set, it gives that same error.