I am not very familiar with python/ipython but somebody was asking me whether it is possible to start an ipython notebook with a specific python file. It then could be used for
import subprocess, os
def executeJupyter():
env_dir = "../main_env_dir/"
os.chdir(env_dir)
# source jupyter_env/bin/activate
env_activate = "jupyter_env/bin/activate_this.py"
activate_env = exec(open(env_activate).read(), {'__file__': env_activate})
# Open jupyter notebook as a subprocess
openJupyter = "jupyter notebook"
subprocess.Popen(openJupyter, shell=True)
executeJupyter()
Make sure you change the env_dir
(directory where you have the env of your jupyter notebook) and the env_activate
to your own.