Skip to content

Commit abe6c50

Browse files
perseoGImemsharded
authored andcommitted
SSH runner: User friendly paramiko import protection (conan-io#18566)
* User friendly paramiko import protection * Updated exception message
1 parent dbd4cfa commit abe6c50

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

conan/internal/runner/ssh.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@ def ssh_info(msg, error=False):
2020
class SSHRunner:
2121

2222
def __init__(self, conan_api, command, host_profile, build_profile, args, raw_args):
23-
from paramiko.config import SSHConfig
24-
from paramiko.client import SSHClient
23+
try:
24+
from paramiko.config import SSHConfig
25+
from paramiko.client import SSHClient
26+
except ImportError:
27+
raise ConanException(
28+
"Paramiko is required for SSH runner. If conan is installed in a virtual environment, try to install "
29+
"the 'paramiko' package, or consider installing conan package with extra requires 'conan[runners]'"
30+
)
2531
self.conan_api = conan_api
2632
self.command = command
2733
self.host_profile = host_profile

0 commit comments

Comments
 (0)