don't use std. commands module 'cause it's Linux-only. Grab code from this module...
authorAlexander Belchenko <bialix@ukr.net>
Fri, 11 Aug 2006 15:15:02 +0000 (18:15 +0300)
committerAlexander Belchenko <bialix@ukr.net>
Fri, 11 Aug 2006 15:15:02 +0000 (18:15 +0300)
libbe/names.py

index cbcfbf815d57a61b4d83f09d0f39809d675f821d..d2e077ada7542f890c60e474a086288edb58b452 100644 (file)
 #    You should have received a copy of the GNU General Public License
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-import commands
+
 import os
 import sys
 
 
 def uuid():
-    return commands.getoutput('uuidgen')
+    # this code borrowed from standard commands module
+    # but adapted to win32
+    pipe = os.popen('uuidgen', 'r')
+    text = pipe.read()
+    sts = pipe.close()
+    if sts not in (0, None):
+        raise "Failed to run uuidgen"
+    if text[-1:] == '\n': text = text[:-1]
+    return text
 
 def creator():
     if sys.platform != "win32":