I ran into an issue where my current traffic generator: Warp17 has generated python code that is only python2 compatible. We are moving all else to python3 so i have created a cli tool that wraps our warp17 api. Is there a better way to pass information from a subscript than just printing the output and loading it in json?
#!/usr/bin/python
import python2_api
if __name__ == "__main__":
do_some_argparse()
result = dict(run_some_code_on_args())
print(result)
def run_warp_cli(*args):
result = subprocess.Popen('warp_cli', args)
return json.loads(result)
This is basically what I am doing. I was curious if there was any interesting way to avoid doing this and get back an actual python dictionary object etc.