diff --git a/indra/test/namedtempfile.h b/indra/test/namedtempfile.h
index 84b62a094575a7d6ce6ff3546daeb7d134c82a63..8cd6c990dc526095c19521117e35baf22a724674 100644
--- a/indra/test/namedtempfile.h
+++ b/indra/test/namedtempfile.h
@@ -83,8 +83,9 @@ class NamedTempFile: public boost::noncopyable
     {
         // Create file in a temporary place.
         boost::filesystem::path tempname{ boost::filesystem::temp_directory_path() };
-        // unique_path() recommended model
-        tempname += stringize(pfx, "%%%%-%%%%-%%%%-%%%%", sfx);
+        // unique_path() recommended template, but with underscores instead of
+        // hyphens: some use cases involve temporary Python scripts
+        tempname += stringize(pfx, "%%%%_%%%%_%%%%_%%%%", sfx);
         mPath = boost::filesystem::unique_path(tempname);
         boost::filesystem::ofstream out{ mPath };