The connection object you're making is just a dictionary. Those keys should be keyword arguments to the Connection constructor you imported.
On Thu, Apr 15, 2021, 09:21 Kaushal Shriyan <kaushalshri...@gmail.com> wrote: > > On Thu, Apr 15, 2021 at 6:05 PM Kaushal Shriyan <kaushalshri...@gmail.com> > wrote: > >> Hi, >> >> $fab -V >> Fabric 2.6.0 >> Paramiko 2.7.2 >> Invoke 1.5.0 >> >> I have this fabfile.py http://sprunge.us/IfF1Ju. when I run fab check, I >> am seeing this issue ModuleNotFoundError: No module named 'fabric.api' >> >> Any examples which relate to fabric2.x for the fabfile.py >> http://sprunge.us/IfF1Ju. Thanks in advance. I look forward to hearing >> from you. >> >> Best Regards, >> >> Kaushal >> > > Hi, > > I did the below using python command line > > $fab -V > Fabric 2.6.0 > Paramiko 2.7.2 > Invoke 1.5.0 > > $python3.9 > Python 3.9.0 (v3.9.0:9cf6752276, Oct 5 2020, 11:29:23) > [Clang 6.0 (clang-600.0.57)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> from fabric import Connection > >>> connection = {"host": "192.168.0.188", "user": "root", "port": 22, > "connect_kwargs": {"password":"test@#!123"}} > >>> result = connection.run('uname -a') > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'dict' object has no attribute 'run' > >>> > > Please correct me if I am missing anything. Thanks in advance. I look > forward to hearing from you. > > Best Regards, >