小编adi*_*anp的帖子

从setup.py安装依赖项

我想知道是否和.deb包一样,在我的setup.py中可以配置我的包的依赖项,然后运行:

$ sudo python setup.py install
Run Code Online (Sandbox Code Playgroud)

它们是自动安装的.已经研究过互联网,但我发现只是让我困惑,像"需要","install_requires"和"requirements.txt"之类的东西

python setuptools install-requires

18
推荐指数
3
解决办法
1万
查看次数

AttributeError:'NoneType'对象没有属性'open_session'"

运行以下功能时:

def conEnclosure():
    freebay = open("freebay", "w+")
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    password = getpass.getpass("Enter the password for infra: ")

    for host in open("full.json", "r"):
        print host
        ssh.connect("%s" % host, username="infra", password="%s" % password)
        stdin, stdout, stderr = ssh.exec_command("show server info all")
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

    Traceback (most recent call last):
  File "./findbay_v2.py", line 53, in <module>
    conEnclosure()
  File "./findbay_v2.py", line 41, in conEnclosure
    ssh.exec_command("show server info all")
  File "build/bdist.macosx-10.9-intel/egg/paramiko/client.py", line 364, in exec_command
AttributeError: 'NoneType' object has no attribute 'open_session'
Run Code Online (Sandbox Code Playgroud)

但是,在python shell中运行时,请执行以下命令:

>>> …
Run Code Online (Sandbox Code Playgroud)

python ssh paramiko attributeerror

6
推荐指数
1
解决办法
8461
查看次数