[New-bugs-announce] [issue3045] Windows online help broken when spaces in TEMP environ

Peter Whaite report at bugs.python.org
Fri Jun 6 05:11:29 CEST 2008

New submission from Peter Whaite <whaite at gmail.com>:

If the environ vars TEMP or TMP contain spaces on w32 the on-line help
will not work.  e.g. help('or') gives the message

    The system cannot find the file specified.

This is because pydoc.tempfilepager sets filename=tempfile.mktemp()
which will have spaces in it if TEMP does.  The filename is then used to
constuct the system command:

     os.system(cmd + ' ' + filename)

which in windows ends up as  os.system('more < FILE WITH SPACES').  The
filename should be quoted, e.g.

     os.system('%s "%s"' % (cmd,filename))

I only ran across this problem because I use uwin on windows and it sets
TEMP to a w32 style long path.  The normal windows command shell uses
the dos spaceless sort form for the TMP and TEMP env vars so the problem
doesn't arise when python is invoked from there.

And isn't tempfile.mktemp() deprecated?

components: Library (Lib), Windows
messages: 67746
nosy: peta
severity: normal
status: open
title: Windows online help broken when spaces in TEMP environ
versions: Python 2.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list