[Spambayes] Unwanted stock solicitations
grevsen at gmail.com
Thu Nov 2 15:23:00 CET 2006
as promised I'm continuing my tests on implementing OCR under Windows.
FYI I'm running from sources recently downloaded through CVS.
> >> ocr = os.popen("ocrad -s %s -c %s -x %s -f %s 2>/dev/null" %
> Vibe> What is the meaning of the last '2' in the os.popen()-call?
> It's a Unix-ism that will probably not work on Windows. It sends error
> messages to the bit bucket.
Ok, I did a little read-up on this.
2> is supported by WinNT, 2k and XP I just newer saw it used before.
2> is not supported in Win9x and ME.
However /dev/null is - of course - not found in Windows. Equivalent is nul (case insensitive).
Better use os.path.devnull like shown here. Parenthesis required for string formatting!
ocr = os.popen( ( "ocrad -s %s -c %s -x %s < %s 2>" + os.path.devnull ) %
(scale, charset, orf, pnmfile))
Now the surprise is that this executes 100% correctly from the interpreter, but it does not when spambayes runs.
I still need to check up on exactly what is going on in Spambayes here.
Maybe you could hint on other parts of the sources I should check for the next lead?
Finally I was surprised to find that
ocrad -s4 -x out.txt >ocr.txt logo.pgm
did produce an ocr.txt but no out.txt for this image http://www.unlockaarhus.dk/dev/logo.pgm.
Maybe it's only a problem with small images? Could you please test if this is the case under Unix as well?
Happy coding :)
More information about the SpamBayes