This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Compiler command percent-sign causes format string error
Type: Stage:
Components: Distutils Versions: Python 2.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: mdcowles
Priority: normal Keywords:

Created on 2006-08-16 23:39 by mdcowles, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (1)
msg29526 - (view) Author: Matthew Cowles (mdcowles) Date: 2006-08-16 23:39
[From a question posted to python-help]

Using Sun's compiler, distutils generates a command line with a 
percent-sign in it:

cc -DNDEBUG -xO3 -xtarget=native -xbuiltin=%all -xdepend=yes -
xlibmil -xlibmopt -xstrconst -Xa -I/opt/pkg/include/db4 -I/usr/
include -I/opt/pkg/include -xcode=pic32 -OPT:Olimit=0 -I. -I/opt/
pkg.obj/lang/python24/work.e450/Python-2.4.3/./Include -I/opt/
pkg/include -I/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/
Include -I/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3 -c /
opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Modules/
structmodule.c -o build/temp.solaris-2.10-sun4u-2.4/structmodule.o

It seems that the percent-sign in "-xbuiltin=%all" isn't escaped when 
distutils goes to print the line and a format string error occurs:

File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/log.py", line 23, in _log
    print msg % args
TypeError: not enough arguments for format string
*** Error code 1

Here's the full traceback:

running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
building 'struct' extension
Traceback (most recent call last):
  File "./setup.py", line 1105, in ?
    main()
  File "./setup.py", line 1099, in main
    scripts = ['Tools/scripts/pydoc2.4',
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/core.py", line 149, in setup
    dist.run_commands()
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/dist.py", line 946, in run_commands
    self.run_command(cmd)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/dist.py", line 966, in run_command
    cmd_obj.run()
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/command/build.py", line 112, in run
    self.run_command(cmd_name)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/dist.py", line 966, in run_command
    cmd_obj.run()
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/command/build_ext.py", line 279, in run
    self.build_extensions()
  File "./setup.py", line 179, in build_extensions
    build_ext.build_extensions(self)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/command/build_ext.py", line 405, in build_extensions
    self.build_extension(ext)
  File "./setup.py", line 184, in build_extension
    build_ext.build_extension(self, ext)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/command/build_ext.py", line 470, in build_extension
    depends=ext.depends)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/ccompiler.py", line 699, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/unixccompiler.py", line 112, in _compile
    self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/ccompiler.py", line 1040, in spawn
    spawn (cmd, dry_run=self.dry_run)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/spawn.py", line 37, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/spawn.py", line 122, in _spawn_posix
    log.info(string.join(cmd, ' '))
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/log.py", line 33, in info
    self._log(INFO, msg, args)
  File "/opt/pkg.obj/lang/python24/work.e450/Python-2.4.3/Lib/
distutils/log.py", line 23, in _log
    print msg % args
TypeError: not enough arguments for format string
*** Error code 1


(I'm posting this for the person who originally ran into the error and 
asked about it on python-help.)
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43839
2006-08-16 23:39:59mdcowlescreate