I have the following code, I am trying to run XFoil (an airfoil analysis code, but that isn't important) from Python.
import subprocess as sp
ps = sp.Popen(r'C:\Users\me\XFoil\xfoil.exe',stdin=sp.PIPE,stderr=sp.PIPE,stdout=sp.PIPE)
When I run, I get the following error:
OSError: [WinError 6] The handle is invalid
With the full list of errors as follows:
File "~/XFoil_Own.py", line 12, in <module>
ps = sp.Popen(r'C:\Users\,e\XFoil\xfoil.exe' ,stdin=sp.PIPE,stderr=sp.PIPE,stdout=sp.PIPE)
File "~\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 210, in __init__
super(SubprocessPopen, self).__init__(*args, **kwargs)
File "~\Anaconda3\lib\subprocess.py", line 596, in __init__
_cleanup()
File "~\Anaconda3\lib\subprocess.py", line 205, in _cleanup
res = inst._internal_poll(_deadstate=sys.maxsize)
File "~\Anaconda3\lib\subprocess.py", line 1035, in _internal_poll
if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] The handle is invalid
I am running Python 3.6 through Anaconda3 and Spyder, on a 64bit windows machine. XFoil is 32bit - I don't know if that is maybe causing the issue, or if it is something else. I haven't been able to find anyone else with the same issue of WinError 6 when running a program like this. Any help would be very much appreciated.