Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: not all arguments converted during string formatting" in logger.debug in networktypeparser.py #42

Open
vpomuran opened this issue May 16, 2024 · 0 comments

Comments

@vpomuran
Copy link
Contributor

"TypeError: not all arguments converted during string formatting" exception is thrown here:
File "/app/build-and-test-webapp/nita-webapp/ngcn_workbench/ngcn/networktypeparser.py", line 176, in normalizeZipFile
logger.debug("os.replace(" + tmp + "/tmp1/" + projectbase, tmp + "/tmp2/" + projectname + ")")
Message: 'os.replace(/tmp/tmpp0gaqzff/tmp1/ebgp_wan'
Arguments: ('/tmp/tmpp0gaqzff/tmp2/ebgp_wan_0.3)',)

The same behavior in a python shell, logging methods expect first format string as a first argument and if there no format symbols throws this exception:

log.debug("a",'/tmp/tmpp0gaqzff/tmp2/ebgp_wan_0.3)')
--- Logging error ---
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/init.py", line 1083, in emit
msg = self.format(record)
File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/init.py", line 927, in format
return fmt.format(record)

File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/init.py", line 663, in format
record.message = record.getMessage()
File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/init.py", line 367, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
File "", line 1, in
Message: 'a'
Arguments: ('/tmp/tmpp0gaqzff/tmp2/ebgp_wan_0.3)',)

This is working example:

log.debug("a %s",'/tmp/tmpp0gaqzff/tmp2/ebgp_wan_0.3)')
DEBUG:test:a /tmp/tmpp0gaqzff/tmp2/ebgp_wan_0.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant