Subprocess Popen communicate can't read stdout from cmd #1975
Replies: 1 comment
-
Totally wrong repo, sorry! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I came across an odd issue today, it could be an issue with the Windows Command prompt, but wonder if anyone has seen this issue before. I am getting some information from a vendor's site using
Selenium
andwebdriver-manager
. I traced the stack down to asubprocess.Popen().communicate()
function, more specifically, line 1196 of subprocess.py (python v 3.12.2 32bit) trying tostdout.read()
. It seems to be some issue reading standard out, it hangs (no error, just continues to run) on that line. I ran the code from within PowerShell (as opposed to VS Code which seems to be using CMD) and it worked. If I don't usestdout=subprocess.PIPE
, it does print CMD (result of the command in webdriver-manager iscmd = "(dir 2>&1 *`|echo CMD);&<# rem #>echo powershell")
and doesn't error, but obviously that isn't all that helpful other than knowing CMD runs a command, just not getting the std out. I have tried other commands too with no such luck.One of the strangest things is it ran just fine daily for at least a year and suddenly had this issue. I tried the same code on another machine and it works as expected but it needs to run on an automation machine. Its a Windows 10 machine... I wouldn't do it if I didn't have to but the legacy program I'm automating only runs on Windows Desktops.
I would override the library but it uses subprocess also to get the current version of Chrome to install and use the proper driver. I have tried for hours and this is the dead end I hit.
Beta Was this translation helpful? Give feedback.
All reactions