python3-openid icon indicating copy to clipboard operation
python3-openid copied to clipboard

"not enough arguments for format string" in oidutil.py

Open pnijjar opened this issue 2 years ago • 1 comments

I was trying to get another project to work. That project uses this one as a library. The version is old (3.1.0) but looking at the current source I think the bug still exists.

Here is the offending error message:

  File "/home/pnijjar/src/GetTogether/venv/lib/python3.9/site-packages/openid/oidutil.py", line 117, in importElementTree
    'Not using ElementTree library %r because it failed to '                      
TypeError: not enough arguments for format string

The latest commit to this line makes one change but does not fix the problem: https://github.com/necaris/python3-openid/commit/728ff9bc9e5903bc675e3bb1dbd1f0eee71b0a39

The offending code is here:

            # Make sure it can actually parse XML
            try:
                ElementTree.XML('<unused/>')
            except (SystemExit, MemoryError, AssertionError):
                raise
            except:
                logger.exception(
                    'Not using ElementTree library %r because it failed to '
                    'parse a trivial document: %s' % (mod_name, ))
            else:
                return ElementTree

There is no corresponding argument for the %s. I am not sure how you want to fix this. My guess is that the '<unused/>' is what goes there, but that is not in a variable so would be duplicating the string literal. You might want to get rid of the %s entirely. I just wanted to alert you since I ran into this problem, and I am guessing this code path is not traversed frequently.

pnijjar avatar Apr 15 '22 23:04 pnijjar

My environment: Debian 11 (32 bit x86) with Python 3.9.2 . I am working through the manual installation instructions here: https://github.com/GetTogetherComm/GetTogether/#getting-started . I follow the instructions up to "Start the Server", then try to log into the site.

I can type a username and password, but when I submit then this error gets generated. The latest commit on the project is https://github.com/GetTogetherComm/GetTogether/commit/0dfb34d5eaad784d868b6cd0c217b05eeaea25f1 . My guess is that this is my fault, but if not then I will file a bug with that project to fix the dependency problem.

pnijjar avatar Apr 15 '22 23:04 pnijjar