ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/mengine.py
Revision: 17
Committed: Mon Jun 23 21:33:34 2008 UTC (14 years, 1 month ago) by tjod
Original Path: trunk/smi23d/src/mengine/mengine.py
File size: 585 byte(s)
Log Message:
Change to popen3 to be able to capture stderr

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