Jamie- / openvpn-api

A Python API for the OpenVPN management interface.
MIT License
56 stars 19 forks source link

NotConnectedError: You must be connected to the management interface to issue commands. #30

Closed ice1x closed 2 years ago

ice1x commented 2 years ago

On alpine:

In [1]: from openvpn_api import VPN
   ...: 
   ...: v = VPN('localhost', 7505)
   ...: v.connect()
   ...: 
---------------------------------------------------------------------------
ConnectError                              Traceback (most recent call last)
Input In [1], in <cell line: 4>()
      1 from openvpn_api import VPN
      3 v = VPN('localhost', 7505)
----> 4 v.connect()

File /usr/lib/python3.8/site-packages/openvpn_api/vpn.py:63, in VPN.connect(self)
     61     return True
     62 except (socket.timeout, socket.error) as e:
---> 63     raise errors.ConnectError(str(e)) from None

ConnectError: [Errno 99] Address not available

On mac:

from openvpn_api import VPN
PyDev console: starting.
v = VPN('localhost', 7505)
v.connect()
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<input>", line 1, in <module>
  File "/Users/name/opt/anaconda3/envs/vpn_ssh_exec/lib/python3.10/site-packages/openvpn_api/vpn.py", line 63, in connect
    raise errors.ConnectError(str(e)) from None
openvpn_api.util.errors.ConnectError: [Errno 61] Connection refused
ice1x commented 2 years ago

It was my mistake, i launched openvpn client without option --management ip port