Reputation: 21
I have problem when importing netmiko module. I've installed the python3-pip and trying to import netmiko module
root@Python,Go,Perl,PHP-1:~# python3
Python 3.5.2 (default, Oct 8 2019, 13:06:37)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import netmiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/netmiko/__init__.py", line 7, in <module>
from netmiko.ssh_dispatcher import ConnectHandler
File "/usr/local/lib/python3.5/dist-packages/netmiko/ssh_dispatcher.py", line 2, in <module>
from netmiko.a10 import A10SSH
File "/usr/local/lib/python3.5/dist-packages/netmiko/a10/__init__.py", line 1, in <module>
from netmiko.a10.a10_ssh import A10SSH
File "/usr/local/lib/python3.5/dist-packages/netmiko/a10/a10_ssh.py", line 3, in <module>
from netmiko.cisco_base_connection import CiscoSSHConnection
File "/usr/local/lib/python3.5/dist-packages/netmiko/cisco_base_connection.py", line 143
msg = f"Login failed: {self.host}"
^
SyntaxError: invalid syntax
Upvotes: 1
Views: 3677
Reputation: 499
Netmiko 3.x.x (and going forward requires Python 3.6 or greater). Netmiko 2.4.2 is the last version to support Python2.7 (or Python 3.5).
F-strings as mentioned above are one thing that will break if you try to use Netmiko 3.x.x with Python 3.5.
Upvotes: 1
Reputation: 2094
As you can see the SyntaxError
that you are receiving happens at this line:
msg = f"Login failed: {self.host}"
This is because your Python version is 3.5 while the f-strings were introduced in Python 3.6 with PEP 498. Upgrading your Python version to 3.6 or later will resolve your issue.
Upvotes: 1