How to run/execute a script saved from a subprocess in python?
I am using Databricks and making a connection with Shell Scripts to my github Repo. I am trying to mimic the same folders/files on the repo onto my Databricks so that it is dynamic as possible. I am taking each Script/Data from the Github repo and pulling that into my Databricks notebook and saving each as a variable. My question is once I have this file/data saved to a variable how can I execute the python script?
Currently my code looks something like this:
%sh git clone githu开发者_C百科b.com/some-repo.git
cd folder/file
import subprocess as sp
some_file = sp.getoutput('cat ./some-script.py;)
print(some_file)
>>> def hell()
>>> print("hello world!")
Also if there is a better way to do this please feel free to recommend. Thank you
精彩评论