首页 > 解决方案 > TypeError: put() 得到了一个意外的关键字参数“use_sudo”

问题描述

我运行以下命令:

 c = Connection('sid', config=config) 
 c.put("local", "/etc/nginx/sites-available/addr", use_sudo=True) 

我明白了

~/.virtualenvs/fabric/lib/python3.7/site-packages/fabric/connection.py in put(self, *args, **kwargs)
    784         .. versionadded:: 2.0
    785         """
--> 786         return Transfer(self).put(*args, **kwargs)
    787 
    788     # TODO: yield the socket for advanced users? Other advanced use cases

TypeError: put() got an unexpected keyword argument 'use_sudo'

我不能用织物芯做这个吗?

标签: pythonfabric

解决方案


最简洁的答案是不。 Connection.put只是一个包装器Transfer.put,只有Transfer.put 三个参数: (1) local, (2)remote和 (3) preserve_mode


推荐阅读