If you need a QByteArray have you tried just:

bArray = QByteArray()
bArray.append("hello")





On Jul 5, 2012, at 9:24 PM, Jay Goodman <[email protected]> wrote:

> I've done some google-ing and haven't seen a lot of discussion on this.  I 
> was wondering if anyone has done any substantial playing, or fighting, with 
> the QProcess in PyQt4.  I found this to be better suited for spawning 
> processes from Qt UI's as opposed to Subprocess--although Subprocess works 
> too, but suffers from its own (and some of the same) issues.  I'm rather left 
> with an uneasy feeling of managing, and interacting, with console processes 
> from Python.
> 
> I'm running a console process that can be terminated with a Ctrl-C or 
> Ctrl-Break input.  The only way I see to do that with the QProcess is with 
> the writeData method, which would take a byteArray, but I am not even sure if 
> that would work?  I can find Hex values for these keys within the QT enums, 
> but I'm not incredibly keen on Hex to Byte Array conversions.
> 
> The other though I had was to use the win32api: 
> win32api.GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, _processId)
> This seems like a good way to handle it, but I find an error of "Invalid 
> Process Handle".  I also get this error when I attempt this with 
> Subprocess--could it be a translation issue between python and win32?  I've 
> done a breakpoint on this and the process id is an integer and not zero.  I 
> don't have a ton of experience with subprocess so I may be doing something 
> entirely wrong here, so any suggestions are greatly appreciated.
> -- 
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings: 
> http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to