[Tutor] A bug in os.popen() in PythonWin 2.2.2 ???

pan@uchicago.edu pan@uchicago.edu
Mon May 12 20:50:02 2003


Hi all,

I wrote a program to run a module codeml.exe (part of PAML 
package). The idea is to use codeml for a batch analysis 
following the steps below:

1. Loop thru a data folder and load data files once at a time;    

    1.meg
    2.meg 
    3.meg 
    ...

2. copy it to a 'data.txt' file which is used by codeml.exe;
3. call codeml.exe and have it do the analysis (it will read
   the 'data.txt' and output to 'tempout.txt'
4. open 'tempout.txt' and parse it to retrieve some info 
5. Do so for all the files (1.meg, 2.meg ...)
6. Save all output to 'output.txt'

I use os.popen('[proper path here]codeml.exe') to call codeml.

What the codeml.exe does is not the issue here. The strange 
thing is, when my code was execuded on one computer [A], it 
works nicely -- the 'output.txt' file recorded different info
correcponding to different data files (1.meg, 2.meg ...).

But when it runs on a different computer [B], the very same code
output an 'output.txt' file which has a list of report with the 
values ALL the same as the first record. Example of output.txt: 

On compter [A]:
  ----------------------
   file        data    
  ---------------------- 
   1.meg      0.234     
   2.meg      0.108    
   3.meg      0.265    
   4.meg       ...     
   .....     ......   
   100.meg    ....    
  ---------------------

On computer [B]:
  ----------------------
   file        data
  --------  ------------ 
   1.meg       0.234
   2.meg       0.234
   3.meg       0.234
   4.meg       0.234
   .....       .....
   100.meg     0.234
   ---------------------
                 ^---- all = that of the first record

I have no idea how this could have happened. The only thing I 
found to be different between [A] and [B] is:

   [A] PythonWin 2.2.1
   [B] PythonWin 2.2.2  ==> the newer the worse ???

Can anyone tell me what's wrong and how to solve it ???
Thx.,

pan