Message85935
| Author |
kermode |
| Recipients |
georg.brandl, kermode, madprog, r.david.murray |
| Date |
2009年04月13日.04:03:58 |
| SpamBayes Score |
0.00017796597 |
| Marked as misclassified |
No |
| Message-id |
<1239595440.26.0.996928067055.issue3440@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
notepad.exe forms a side-by-side assembly with COMCTL32.DLL. So
SystemRoot must be included in the environment. The following example
works with Python 2.5.2 on Windows XP.
===============================================================
import struct, subprocess
import os
command = 'C:\\WINDOWS\\NOTEPAD.EXE'
env = {'FOO': 'bar', 'SystemRoot': os.environ['SystemRoot']}
p = subprocess.Popen(command, env=env)
p.wait()
err = struct.unpack('I', struct.pack('i', p.returncode))[0]
print '%x (%d)'%(err, err)
===============================================================
I would suggest Popen adds SystemRoot to env if it is not present. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年04月13日 04:04:00 | kermode | set | recipients:
+ kermode, georg.brandl, r.david.murray, madprog |
| 2009年04月13日 04:04:00 | kermode | set | messageid: <1239595440.26.0.996928067055.issue3440@psf.upfronthosting.co.za> |
| 2009年04月13日 04:03:59 | kermode | link | issue3440 messages |
| 2009年04月13日 04:03:58 | kermode | create |
|