Bug 356949 - No encoding specified in generated python files
Summary: No encoding specified in generated python files
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 2.17.0 (KDE Applications 15.08.0)
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-20 13:25 UTC by Ralf Habacker
Modified: 2015-12-20 13:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 2.18.1 (KDE Applications 15.12.1)


Attachments
test case (11.40 KB, text/x-xmi)
2015-12-20 13:26 UTC, Ralf Habacker
Details

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