<div dir="ltr">I'm having trouble understanding exactly how this function works.  At the top, there is the following comment:<div><br></div><div><div>        // We want to call run_one_line, passing in the dictionary and the command string.  We cannot do this through</div><div>        // PyRun_SimpleString here because the command string may contain escaped characters, and putting it inside</div><div>        // another string to pass to PyRun_SimpleString messes up the escaping.  So we use the following more complicated</div><div>        // method to pass the command string directly down to Python.</div></div><div><br></div><div>Two questions.  First, can you elaborate on the issue with escaped characters?  PyRun_SimpleString() should be able to accept strings with escaped characters in them.  Are you saying this isn't the case?</div><div><br></div><div>Second, can you explain the more complicated method that is being used?  I see some pipes, a background thraeding doing some reading, something about dev/null, and a bunch of IOHandler stuff I don't really understand.</div><div><br></div><div>If the entire function could be reduced to a single call to PyRun_SimpleString() if the escaping problem were fixed, then would it work to try to just manipulate the string directly to double-escape, or do soemthing else to it so that PyRun_SimpleString worked, to avoid this complicated logic?</div></div>