Issue 121612 - Mail merge broken due to Python3 conversion
Summary: Mail merge broken due to Python3 conversion
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: scripting (show other issues)
Version: 3.4.1
Hardware: All All
: P3 Normal (vote)
Target Milestone: 4.0.0
Assignee: Ariel Constenla-Haile
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-11 21:29 UTC by Ariel Constenla-Haile
Modified: 2022-10-28 12:54 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
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.