简体   繁体   中英

Python - Zero length field name in format

I'm using Python on my Centos machine and when I try to run my program I have this error displayed :

Running setup.py egg_info for package pyepr
Traceback (most recent call last):
  File "<string>", line 16, in <module>
  File "/tmp/pip-build-root/pyepr/setup.py", line 68, in <module>
    print('using EPR C API sources at "{}"'.format(eprsrcdir))
ValueError: zero length field name in format
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "<string>", line 16, in <module>

  File "/tmp/pip-build-root/pyepr/setup.py", line 68, in <module>

print('using EPR C API sources at "{}"'.format(eprsrcdir))

ValueError: zero length field name in format

I have already checked the other questions about this subject and I already installed Python 2.7.6 and set it as my default configuration as shown below....

 $ python -V
 Python 2.7.6

Something must have gone wrong, but I don't know what.

Anybody has an idea?

Thanks

That error can only be raised if you run that code with Python 2.6 or older. In those versions, you must explicitly number the format fields for str.format (starting at 0 ):

print('using EPR C API sources at "{0}"'.format(eprsrcdir))

Of course, this is only a temporary fix. It would be better to investigate why your code is not being run with Python 2.7 in the first place and then fix that instead.

If you run an install using sudo, you are going to end up using the sudo path's Python interpreter. Not sure if you are using sudo or not for installing, but there is a good chance you are.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM