Bug 356949

Summary: No encoding specified in generated python files
Product: [Applications] umbrello Reporter: Ralf Habacker <ralf.habacker>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 2.17.0 (KDE Applications 15.08.0)   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 2.18.1 (KDE Applications 15.12.1)
Attachments: test case

Description Ralf Habacker 2015-12-20 13:25:51 UTC
Python files generated by the python code generator do not include an encoding specification, which let python 2.7 fail to parse those files.
 

Reproducible: Always

Steps to Reproduce:
1. start umbrello
2. load appended xmi file
3. generated python code

Actual Results:  
python interpreter 2.7 fails with the following message:
  File "/home/ralf/uml-generated-code/new_class.py", line 17
SyntaxError: Non-ASCII character '\xc3' in file /home/ralf/uml-generated-code/new_class.py on line 18, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details


Expected Results:  
python should be able to parse generated python files.
Comment 1 Ralf Habacker 2015-12-20 13:26:19 UTC
Created attachment 96215 [details]
test case
Comment 2 Ralf Habacker 2015-12-20 13:28:53 UTC
Git commit f1e25ab4afb56a363ec25500c0aacbfa203e3fef by Ralf Habacker.
Committed on 20/12/2015 at 13:27.
Pushed by habacker into branch 'Applications/15.12'.

Fix 'No encoding specified in generated python files'.

FIXED-IN:2.18.1 (KDE Applications 15.12.1)

M  +2    -0    umbrello/codegenerators/python/pythonwriter.cpp

http://commits.kde.org/umbrello/f1e25ab4afb56a363ec25500c0aacbfa203e3fef