Dear Phil
That was exactly the problem! Thanks very much for your help!
This is the corrected function, with stderr set to None:
def start(self):
cmd = "%s -f %s" % (self.cmd_path, self.model_path)
if self.recaser_model_path:
cmd = "%s | %s -v 0 -f %s -dl 1" \
% (cmd, self.cmd_path, self.recaser_model_path)
print cmd
self.proc = subprocess.Popen(cmd, shell=True,
stderr=None,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
It's been running now for a few hundred sentences, so I assume it's OK.
In earlier versions I was reading from stderr to check on errors. I
just commented out the stderr.read() line, and then later deleted it,
... Thanks for reviewing my code!
Best wishes
Ivan
On 04/05/2010 22:30, Philip Williams wrote:
> On Tuesday, May 04, 2010, at 09:44PM, "Ivan
> Uemlianin"<[email protected]> wrote:
>
>> @Phil: you wrote
>>
>>
>>>> Possibly moses' output
>>>> isn't getting flushed after every line.
>>>>
>> Can I make it do that explicitly? Flushing the stdout doesn't work.
>> More command-line settings for moses?
>>
> Hmmm, from what Raphael says it doesn't sounds like that's the problem,
> but here's another idea: have you tried setting Popen's stderr parameter to
> None? The subprocess documentation contains the following warning:
>
> Use communicate() rather than stdin.write(), stdout.read() or
> stderr.read() to avoid deadlocks due to any of the other OS pipe buffers
> filling up and blocking the child process.
>
> You're never reading from the stderr file object, so maybe that
> buffer's filling up...
>
> Phil
>
--
********************************
Ivan Uemlianin
Canolfan Bedwyr
Safle'r Normal Site
Prifysgol Bangor University
BANGOR
Gwynedd
LL57 2PZ
[email protected]
http://www.bangor.ac.uk/~cbs007/
********************************
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support