Python sub process!?

Hello everybody,
Recently I came across sub process in python and decided to put hands on and i was able to run windows command promt from iron python inside dynamo that leds to few questions

  1. Can we call python inside iron python as sub process and use the packages we weren’t able to use before and get the output back in iron python?

  2. Have you ever tried such a thing? If so can you post it for my reference.

Actually I have a friend who is a data scientist I am looking forward to learn ML from him and bring it to dynamo via the process.

I’ve never tried this, but it might be crazy enough to work. See this entry in the IronPython Cookbook for reference. You might be able to use the pickle module to pass data between your IronPython node and your CPython script.

1 Like

@cgartland thanks for the input,starting from there I was able to call c-python with subprocess but, still have a long way to go checking it with std inputs ect…

here is a screen shot.

One important Question that makes me worried is that how do I make sure if the end user has the packages installed?

Is there a way to Pip install right from our python script instead of calling cmd.?

I tried calling command to pip install before starting to run actual code but doesnt work

subprocess.call(['cmd','pip install networkx'])

1 Like