Windows Error : Erreur 6 : Descripteur non valide
Bonjour,
Je suis en train de développer un plugin python sur QGIS. J'essaie d'exécuter des exécutables depuis mon code en utilisant subprocess.popen :
Code:
1 2 3 4 5 6 7 8 9
| program = os.path.join(self.tranusConf.tranusBinPath,'pasos' + self.extension)
if not os.path.isfile(program):
logging.error('The <pasos> program was not found in %s'%self.tranusBinPath )
return 0
outpasos = os.path.join(self.resultDirectory, "outpasos.txt")
outpasoserr = os.path.join(self.resultDirectory, "outpasoserr.txt")
args = [program, self.tranusConf.scenarioId, " "]
result = subprocess.Popen(args,stdout=open(outpasos, "w"), stderr = open(outpasoserr, 'w'), close_fds = False, cwd = self.tranusConf.workingDirectory) # Success!
return 1 |
J'ai eu ce problème :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| An error has occurred while executing Python code:
WindowsError: [Error 6] Descripteur non valide
Traceback (most recent call last):
File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\launch_tranus_dialog.py", line 109, in run_tranus
interface.runTranus(tab.spin_box.value())
File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\LcalInterface.py", line 426, in runTranus
self.runPasos()
File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\LcalInterface.py", line 311, in runPasos
result = subprocess.Popen(args,stdout=open(outpasos, "w"), stderr = open(outpasoserr, 'w'), close_fds = False, cwd = self.tranusConf.workingDirectory) # Success!
File "C:\OSGEO4~1\apps\Python27\lib\subprocess.py", line 703, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\OSGEO4~1\apps\Python27\lib\subprocess.py", line 839, in _get_handles
p2cread = self._make_inheritable(p2cread)
File "C:\OSGEO4~1\apps\Python27\lib\subprocess.py", line 878, in _make_inheritable
_subprocess.DUPLICATE_SAME_ACCESS)
WindowsError: [Error 6] Descripteur non valide |
Pour infos, mon OS : Windows 7 64 bits.