[GRASS-SVN] r69337 - grass-addons/grass7/misc/m.printws

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Sep 1 09:36:00 PDT 2016


Author: kuszinger
Date: 2016-09-01 09:36:00 -0700 (Thu, 01 Sep 2016)
New Revision: 69337

Modified:
   grass-addons/grass7/misc/m.printws/m.printws.py
Log:
making pwd module dependecy conditional to support windows


Modified: grass-addons/grass7/misc/m.printws/m.printws.py
===================================================================
--- grass-addons/grass7/misc/m.printws/m.printws.py	2016-09-01 14:37:30 UTC (rev 69336)
+++ grass-addons/grass7/misc/m.printws/m.printws.py	2016-09-01 16:36:00 UTC (rev 69337)
@@ -173,7 +173,11 @@
 
 import sys
 import os
-import pwd
+
+if os.name <> 'nt':
+    import pwd
+
+
 import atexit
 import re
 import tempfile
@@ -567,7 +571,10 @@
     textmacros['%TIME24%'] = time.strftime("%H:%M:%S")
     textmacros['%DATEYMD%'] = time.strftime("%Y.%m.%d")
     textmacros['%DATEMDY%'] = time.strftime("%m/%d/%Y")
-    textmacros['%USERNAME%'] = pwd.getpwuid(os.getuid())[0]
+    if os.name == 'nt':
+        textmacros['%USERNAME%'] = '(windows user)'
+    else:
+        textmacros['%USERNAME%'] = pwd.getpwuid(os.getuid())[0]
     # using $ for macros in the future. New items should be created
     # exclusively as $macros later on
     textmacros['\$TIME24'] = textmacros['%TIME24%']



More information about the grass-commit mailing list