Issue 121612

Summary: Mail merge broken due to Python3 conversion
Product: General Reporter: Ariel Constenla-Haile <arielch>
Component: scriptingAssignee: Ariel Constenla-Haile <arielch>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: issues, pfg
Version: 3.4.1   
Target Milestone: 4.0.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description Ariel Constenla-Haile 2013-01-11 21:29:07 UTC
revision 1423676 seems to have applied the "2to3 source-to-source conversion tool, all print statements are automatically converted to print() function calls, so this is mostly a non-issue for larger projects."

http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function

Converting statements as the following:

Old: print >>sys.stderr, "fatal error"
New: print("fatal error", file=sys.stderr)

print("fatal error", file=sys.stderr) is no valid Python 2 syntax, so this broke mailmerge.py
Comment 1 SVN Robot 2013-01-13 17:31:46 UTC
"arielch" committed SVN revision 1432668 into trunk:
i121612 - Fix broken python mail component
Comment 2 Ariel Constenla-Haile 2013-01-13 17:35:52 UTC
Fixed by replacing 

print( "$STRING", file=sys.stderr)

only valid in Python3, with

out = sys.stderr
out.write("$STRING\n")

that works both in Python2 and Python3.

I only checked the mail component, but other stuff might be broken to.
Comment 3 Pedro Giffuni 2013-01-14 15:18:59 UTC
(In reply to comment #2)
> Fixed by replacing 
> 
> print( "$STRING", file=sys.stderr)
> 
> only valid in Python3, with
> 
> out = sys.stderr
> out.write("$STRING\n")
> 
> that works both in Python2 and Python3.
> 
> I only checked the mail component, but other stuff might be broken to.

Thank you for the fix!

I opengroked "sys.stderr" and it appears it was the only case where this happened.