[CentralOH] Capturing stdin/out when using ctypes?

Joshua Kramer joskra42.list at gmail.com
Fri Jan 24 21:10:09 CET 2014


Hello Group...

Here's a tricky one.  My platform is cpython 2.7 on Windows 7.  I am using
the ctypes library to run a routine inside of a third-party DLL.  This DLL
presents the user with a prompt and waits for input.

If I spawn an .exe from a Python script, I can capture stdout and insert
data on stdin.  Is there some way to do this when I am calling a DLL
instead of spawning an .EXE?

I could write a small "stub script" that does all of the DLL work, and then
call that stub script from my main script by spawning
"c:\python27\python.exe c:\users\josh\myscript.py" and attaching to the
stdin/out of that subprocess.  But I'd like to have everything neatly
contained in one process if possible.

Thanks!
-JK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20140124/181d01ff/attachment.html>


More information about the CentralOH mailing list