1 |
import os |
2 |
|
3 |
cmd = os.curdir + os.sep + "mengine.exe -dxi" |
4 |
# mengine will read multi-molblock sdf files, |
5 |
# but calling through popen2 with some (large?) files hangs on windows, |
6 |
# even though the same file runs fine at command line. |
7 |
# So, split into separate files. |
8 |
for molblock_in in (file("drugs.sdf").read()).split('$$$$\n'): |
9 |
#for molblock_in in (file("caffeine.sdf").read()).split('$$$$\n'): |
10 |
#for molblock_in in (file("acaffeine.sdf").read()).split('$$$$\n'): |
11 |
if len(molblock_in) > 0: |
12 |
mengine_in, mengine_out, mengine_err = os.popen3(cmd) |
13 |
mengine_in.write(molblock_in) |
14 |
mengine_in.close() |
15 |
molblock_out = mengine_out.read() |
16 |
print molblock_out, |
17 |
print mengine_err.read(), |