circus-tent / circus

A Process & Socket Manager built with zmq
http://circus.readthedocs.org/
Other
1.55k stars 258 forks source link

backports.configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%Y-%m-%d %H:%M:%S:%F %s: %t' #1097

Closed bugcy013 closed 4 years ago

bugcy013 commented 5 years ago

Hi Guys,

When I try to run circusd in windows server 2008rc2. I am getting this exception. I am using Python 2.7.15

backports.configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%Y-%m-%d %H:%M:%S:%F %s: %t'

PS C:\tech\tech_recorder> circusd.exe tech.cfg
Traceback (most recent call last):
  File "c:\users\tau\anaconda2\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\users\tau\anaconda2\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Users\tau\Anaconda2\Scripts\circusd.exe\__main__.py", line 9, in <module>
  File "c:\users\tau\anaconda2\lib\site-packages\circus\circusd.py", line 126, in main
    arbiter = Arbiter.load_from_config(args.config)
  File "c:\users\tau\anaconda2\lib\site-packages\circus\arbiter.py", line 422, in load_from_config
    cfg = get_config(config_file)
  File "c:\users\tau\anaconda2\lib\site-packages\circus\config.py", line 194, in get_config
    section_items = dict(cfg.items(section))
  File "c:\users\tau\anaconda2\lib\site-packages\circus\config.py", line 66, in items
    items = StrictConfigParser.items(self, section)
  File "c:\users\tau\anaconda2\lib\site-packages\backports\configparser\__init__.py", line 878, in items
    return [(option, value_getter(option)) for option in d.keys()]
  File "c:\users\tau\anaconda2\lib\site-packages\backports\configparser\__init__.py", line 875, in <lambda>
    section, option, d[option], d)
  File "c:\users\tau\anaconda2\lib\site-packages\backports\configparser\__init__.py", line 384, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "c:\users\tau\anaconda2\lib\site-packages\backports\configparser\__init__.py", line 434, in _interpolate_some
    "found: %r" % (rest,))
backports.configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%Y-%m-%d %H:%M:%S:%F %s: %t'

tech.cfg

[circus]
check_delay = 5
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
stats_endpoint = tcp://127.0.0.1:5557
loglevel = ERROR
logoutput = C:\tech\tech_recorder\logs\sysout\circusd-stdout.txt

[watcher:techrecorder]
cmd = 'C:\tech\tech_recorder\bin\techData.exe -cfg C:\tech\tech_recorder\tech.cfg'
use_sockets = True
numprocesses = 1
copy_env = True
working_dir = C:\tech\tech_recorder\bin
kennytilton commented 4 years ago

Did this ever get resolved? I am seeing that in 0.16.1 n a fresh build on Mac OS X, triggered by this line:

tdout_stream.time_format = %Y-%m-%d %H:%M:%S [webapp]

btw, I do not see the % in your text! :)

biozz commented 4 years ago

The quick solution is to interpolate % with another %:

stdout_stream.time_format = %%Y-%%m-%%d %%H:%%M:%%S 

What I found was that if you change ConfigParser to RawConfigParser it works without extra % interpolation. But I am not sure about the consequences and will try to find that out.

https://github.com/circus-tent/circus/blob/2bedab09145a4959ce02b93777dbffbce56edd8e/circus/util.py#L755

I also notice that documentation for that is not correct, so we will have to decide: use the extra interpolation or change the config parser.