dagrha / pypia

Configuration of Private Internet Access VPN routes for Linux
GNU General Public License v3.0
78 stars 15 forks source link

Error using pypia on PythonAnywhere #41

Closed sofritto closed 5 years ago

sofritto commented 5 years ago

When I run pypia -i in the console at PythonAnywhere I get the following error:

Traceback (most recent call last): File "/home/MyProject/.virtualenvs/myproject/bin/pypia", line 10, in sys.exit(main()) File "/home/MyProject/.virtualenvs/,yproject/lib/python3.5/site-packages/pypia/pypia.py", line 336, in main distro.install_packages() File "/home/MyProject/.virtualenvs/myproject/lib/python3.5/site-packages/pypia/pypia.py", line 83, in install_packages subprocess.call(['sudo'] + [i for i in self.install_command.format(package).split()]) File "/usr/lib/python3.5/subprocess.py", line 247, in call with Popen(*popenargs, **kwargs) as p: File "/usr/lib/python3.5/subprocess.py", line 676, in init restore_signals, start_new_session) File "/usr/lib/python3.5/subprocess.py", line 1289, in _execute_child raise child_exception_type(errno_num, err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'sudo'

Any suggestions?

dagrha commented 5 years ago

It appears that the error is being raised because the sudo command is not recognized on that system.

I'm not too familiar with PythonAnywhere. What distribution does PythonAnywhere use? Does one have root privileges on a PythonAnywhere instance? In order to install a couple system packages (network-manager-openvpn and dependencies) and to write to /etc/NetworkManager, pypia requires root privileges, and it invokes sudo to do so.

If you do have root privileges, you could first install sudo and try running pypia again.

sofritto commented 5 years ago

Thanks!

I've been in touch with PythonAnywhere and it's not possible to get root privileges there. So basically you were right.