# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2015 EDF R&D
+# Copyright (C) 2007-2016 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#
# Modules Python
-import string,types,os
+import string,types,os, sys
import traceback
+import tempfile
from qtsalome import *
# Je n arrive pas a utiliser le setEnvironment du QProcess
# fonctionne hors Salome mais pas dans Salome ???
cmds=''
- cmds+='rm -f '+self.parent().fichierOut+'\n'
+ #cmds+='#! /usr/bin/env python\n'
+ #cmds+='# -*- coding: utf-8 -*-\n'
cmds+=txt+'\n'
- cmds+='echo END_OF_Yams\n'
- pid=self.monExe.pid()
- nomFichier='/tmp/Yams_'+str(pid)+'.sh'
+ cmds+='echo "END_OF_Yams"\n'
+ if os.path.exists(self.parent().fichierOut):
+ os.remove(self.parent().fichierOut)
+
+ ext=''
+ if sys.platform == "win32":
+ ext = '.bat'
+ else:
+ ext = '.sh'
+
+ nomFichier=tempfile.mktemp(suffix=ext,prefix='Yams_')
f=open(nomFichier,'w')
f.write(cmds)
f.close()
- maBidouille='sh ' + nomFichier
+ maBidouille=nomFichier
self.monExe.start(maBidouille)
self.monExe.closeWriteChannel()
self.enregistreResultatsDone=False