开发者

How to run/execute a script saved from a subprocess in python?

开发者 https://www.devze.com 2022-12-07 21:25 出处:网络
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 t

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

0

精彩评论

暂无评论...
验证码 换一张
取 消