[IPython-user] FW: embedding IPython in windows dll

mani sabri mani.sabri@gmail....
Mon Mar 10 05:16:15 CDT 2008



>-----Original Message-----
>From: mani sabri [mailto:mani.sabri@gmail.com]
>Sent: Monday, March 10, 2008 12:56 PM
>To: 'Alexander Belchenko'
>Subject: RE: [IPython-user] embedding IPython in windows dll
>
>OK, now I have a console and the HANDLEs of stdout, stdin and stderr.
>
>	  BOOL res = AllocConsole();
>	  HANDLE OutHand = GetStdHandle(STD_OUTPUT_HANDLE);
>	  HANDLE InHand = GetStdHandle(STD_INPUT_HANDLE);
>	  HANDLE ErrHand = GetStdHandle(STD_ERROR_HANDLE);
>	  Py_Initialize();
>	  if (!Py_IsInitialized()) return(FALSE);
>	  import_array1(-1);
>	  modstring = PyString_FromString("numpy");
>	  mod = PyImport_Import(modstring);
>
>	PyRun_SimpleString("dt = numpy.dtype([('ctm', uint), ('open',
>double), ('low', double), ('high', double), ('close', double), ('vol',
>double)])");
>	PyRun_SimpleString("from IPython.Shell import IPShellEmbed");
>	PyRun_SimpleString("ipshell = IPShellEmbed()");
>	PyRun_SimpleString("ipshell()");
>
>Can I redirect the Ipython to standard console?
>
>Best regards,
>Mani
>
>>-----Original Message-----
>>From: ipython-user-bounces@scipy.org [mailto:ipython-user-
>>bounces@scipy.org] On Behalf Of Alexander Belchenko
>>Sent: Monday, March 10, 2008 10:21 AM
>>To: ipython-user@scipy.net
>>Subject: Re: [IPython-user] embedding IPython in windows dll
>>
>>mani sabri пишет:
>>> Dll doesn't crash or ... everything works fine but there is no shell!
>Can
>>> anybody help?
>>
>>If your main program is Windows GUI you need to explicitly create console
>>with Win32 API
>>(AllocConsole function) and then attach it to your program.
>>
>>http://msdn2.microsoft.com/en-us/library/ms682010(VS.85).aspx
>>
>>_______________________________________________
>>IPython-user mailing list
>>IPython-user@scipy.org
>>http://lists.ipython.scipy.org/mailman/listinfo/ipython-user



More information about the IPython-user mailing list