[Pythonmac-SIG] Popen2

Fran ç ois Granger fgranger at fgranger.com
Wed Dec 29 09:12:40 CET 2004


I am trying to use popen2.popen3 and I am stuck.

I tested the command line I am building and it works ok. This may be due to
my lack of knowledge of the command line functionnalities... But this script
either hang or raise an error.

This is the bare bone script directly copied from the sample:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""r, w, e = popen2.popen3('python slave.py')
e.readlines()
r.readlines()
r.close()
e.close()
w.close()"""

import popen2

theString = file('testfiles/notes.htm').read()
source = 'macintosh'
target = 'UTF-8'
r, w, e = popen2.popen3('iconv -f ' + source.upper() + ' -t ' +
target.upper() + '//TRANSLIT')
w.write(theString)
e.readlines()
result = r.readlines()
r.close()
e.close()
w.close()
print result
pass



More information about the Pythonmac-SIG mailing list