Skip to content

ecp-get-cookie --verbose fails when starting with no cookies

The ecp-get-cookie script fails when attempting to print the cookiejar when it started with no cookies, this is because the cookiejar object isn't being updated as we go along, so if you start with no cookies, the attempt to print still operates on no cookies, and then falls over:

$ python -m ciecplib.tool.ecp_get_cookie --kerberos --identity-provider login.ligo.org --cookiefile ./
cookies --debug --verbose https://ldas-jobs.ligo.caltech.edu
Initialising new session...
Storing cookies...
Cookie stored in './cookies'
Traceback (most recent call last):
  File "/home/duncan/opt/mambaforge/envs/py39/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/duncan/opt/mambaforge/envs/py39/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/duncan/git/ciecplib/ciecplib/tool/ecp_get_cookie.py", line 197, in <module>
    main()
  File "/home/duncan/git/ciecplib/ciecplib/tool/ecp_get_cookie.py", line 187, in main
    fmt = "%-{0}s %-5s %-7s %s".format(max(len(i[0]) for i in info))
ValueError: max() arg is an empty sequence