Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell integration with Python (not IronPython)

I know it is possible to use Powershell from within IronPython, but is this possible using CPython beyond using Popen() and other similar calls? I'm trying to do some very basic NET framework programming (windows Forms, etc.) like you can do inside of IronPython using CPython.

Thanks!

Any help appreciated.

like image 435
reckoner Avatar asked Dec 15 '10 23:12

reckoner


1 Answers

I am not sure why you got downvoted as this is a legitimate question. I think the best integration you are going to get trying to integrate PowerShell into CPython will be through spawning a new process and passing in the PowerShell script you want run. Unfortunately this will also mean parsing any output that is generated as well. There is not a COM or C library you can really link against to get much better.

There might be some sort of a general .NET interop library for CPython (I haven't checked), but that may be an option, using that layer you could (at least in theory) use the same techniques as embedding the PowerShell runtime into a regular .NET App.

like image 67
Goyuix Avatar answered Nov 13 '22 12:11

Goyuix