Why does tempfile use DOS 8.3 directory names on my XP box?

>>> import tempfile >>> tempfile.mkstemp() (3, 'c:\\docume~1\\k0811260\\locals~1\\temp\\tmpk6tpd3') 

It works, but it looks a bit strange. and the actual temporary file name is more than 8 letters.

Why doesn't he use long file names instead?

+4
source share
1 answer

mkstemp uses the TMPDIR, TEMP, or TMP environment variables (the first one installed) to determine where to put your temporary file. One of them is probably set to c:\docume~1\k0811260\locals~1\temp on your system . Release

 echo %%tmp%% 

etc .. in the command window ("DOS box") to find out for sure.

This is actually good, because some naive modules / programs (for example, those that invoke external OS commands) may get confused when the directory name contains a space due to citation problems.

+3
source

All Articles