[root@MrYang ~]# python
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fabric.api import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/fabric/api.py", line 9, in <module>
from fabric.context_managers import (cd, hide, settings, show, path, prefix,
File "/usr/lib/python2.6/site-packages/fabric/context_managers.py", line 42, in <module>
from fabric.state import output, win32, connections, env
File "/usr/lib/python2.6/site-packages/fabric/state.py", line 9, in <module>
from fabric.network import HostConnectionCache, ssh
File "/usr/lib/python2.6/site-packages/fabric/network.py", line 24, in <module>
import paramiko as ssh
File "/usr/lib/python2.6/site-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/usr/lib/python2.6/site-packages/paramiko/transport.py", line 89, in <module>
class Transport(threading.Thread, ClosingContextManager):
File "/usr/lib/python2.6/site-packages/paramiko/transport.py", line 103, in Transport
_CLIENT_ID = 'paramiko_{}'.format(paramiko.__version__)
ValueError: zero length field name in format
When using the paramiko third-party library of python2.6.6 and python3.6 on centos6.9, the above error has been reported all the time
Python official recommendation str.format () to format strings, so using “{} / N”. Format (x) to process strings may encounter problems.
In Python 2 & gt; = 2.7 and python 3 & gt; = 3.1, str.format The positional parameter in () method can be omitted by default, but in Python 2 (& lt; 2.7) and python 3 (& lt; 3.1), you must display the specified (subscript starts from 0), otherwise “zero length field name in format” error will appear.
“{}CMD”.format( os.sep )# “{0} CMD”. Format can run normally in Python 2.7( os.sep )# in Python & lt; = 2.6 / 3.1, the specified subscript must be displayed, even if there is only one element.
Reference link: https://www.aliyun.com/jiaocheng/460757.html
Read More:
- Pre initialization of list content and length in Python
- Cannot find module ‘.. / lib / utils / unsupported. JS’ problem in installing node in centos7
- CentOS solves the problem of modulenotfounderror when salt calls python3 script remotely, and solves the problem that PIP3 module cannot be shared by different users
- Solution to the problem that listen TCP 0.0.0.0:3306: bind: address already in use port is occupied in Linux centos7
- Solve the problem of Python in Windows environment: Fatal error in launcher: Unable to create process using’”‘ in pip installation
- Jsonformat annotation solves the problem of time format in the front end of localdatetime
- How to Install Python 3 in Centos7 Quickly
- Solve the problem of unable to locate package python3.6 when upgrading from python3.5 to python3.6 in ubantu16.04
- Fatal error in CentOS: Python. H: no that file or directory
- To solve the problem that deep in 20.2 system cannot save and transform the format of typora, and provide an effective installation method of typora
- Solve the problem of prompt couldn’t find path to unrear library after installing unrear in Python
- Error: command error out with exit status 1: Python when installing mysqlclient in centos7 setup.py egg_ info Check
- In Python, import XXX does not report an error, but in IPython (Jupiter notebook)
- Solve the problem of using in tensoft 2. X tf.contrib.slim No module named appears in the package: tensorflow.contrib problem
- Error in installing centos8.3: DFN error: error in postrans scriptlet in RPM package kernel core
- Python: How to Fix “Ord() expected string of length 1, but int found”
- The problem of failed to create process occurs in pyinstaller package program of Python
- Error reporting in CentOS 7 using yum
- Solution of duplicate entry ‘value’ for key ‘field name’ in MySQL
- MySQL error: column ‘ID’ in field list is ambiguous