OS X 10.13.6
Python 3.6
I am trying to run the following command from a jupyter notebook:
vpn_cmd = '''
sudo openvpn
--config ~/Downloads/configs/ipvanish-US-Chicago-chi-a49.ovpn
--ca ~/Downloads/configs/ca.ipvanish.com.crt'''
proc = Popen(vpn_cmd.split(), stdout=PIPE, stderr=STDOUT)
stdout, stderr = proc.communicate()
print(stdout.decode())
But get the error:
sudo: openvpn: command not found
What I've tried:
- added
export PATH="/usr/local/sbin:$PATH"
to my ~/.bash_profile and can run the thesudo openvpn
command from my terminal - edited my sudoers file so
sudo
no longer prompts for a password - called
sudo which openvpn
and tried adding/usr/local/sbin/openvpn
to my sys.path within python - not splitting
vpn_cmd
and settingshell=True
- tried packaging it in a test.py script and executing from the terminal, but it just hangs at the
proc.communicate()
line - specified the full path for the
--config
and--ca
flags
So far, nothing has fixed this. I can run openvpn
from my terminal just fine. It seems like a simple path issue but I can't figure out what I need to add to my python path. Is there something particular with the jupyter notebook kernel?