Skip to main content

OSError: [WinError 6] The handle is invalid, running subprocess.Popen on Python 3.6

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 
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.

Comments

Popular posts from this blog

Mapping column names to random forest feature importances

I am trying to plot feature importances for a random forest model and map each feature importance back to the original coefficient. I've managed to create a plot that shows the importances and uses the original variable names as labels but right now it's ordering the variable names in the order they were in the dataset (and not by order of importance). How do I order them in order of feature importance? Thanks! My code is: importances = brf.feature_importances_ std = np.std([tree.feature_importances_ for tree in brf.estimators_], axis=0) indices = np.argsort(importances)[::-1] # Print the feature ranking print("Feature ranking:") for f in range(x_dummies.shape[1]): print("%d. feature %d (%f)" % (f + 1, indices[f], importances[indices[f]])) # Plot the feature importances of the forest plt.figure(figsize=(8,8)) plt.title("Feature importances") plt.bar(range(x_train.shape[1]), importances[indices], color="r", yerr=...

SQLCODE Error -122

I'm not used to SQL a lot, so maybe my question is so dumb, don't be hard with me guys ;) So, this is my table PEOPLE, and what i want is with a query is find the people that are not in an expecific age, but im getting an error. PEOPLE +-------+------+---------+ | NUMPOL| MCT | PRODNUM| +-------+------+---------+ | 98552 | 1054 | 9704 | +-------+------+---------+ | 89854 | 0985 | 5014 | +-------+------+---------+ | 78542 | 1054 | 9704 | +-------+------+---------+ | 98552 | 0965 | 9704 | +-------+------+---------+ | 98552 | 4222 | 9704 | +-------+------+---------+ I'm trying to run this query SELECT NUMPOL, MCT, PRODCO FROM PEOPLE WHERE MCT NOT IN (1054,0965) AND PRODNUM='9704' GROUP BY NUMPOL And this is the error that I'm getting, I tried to solve it googling but never could find an answer because I can't find why it told me that the select list is not valid: SQLCODE = -122, ERROR: COLUMN OR...