View Issue Details

IDProjectCategoryView StatusLast Update
0002196FreeCADBugpublic2015-08-05 02:33
Reporterrparkins Assigned Toyorik  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformPCOSLinuxOS VersionUbuntu 14.04.2 L
Product Version0.15 
Fixed in Version0.16 
Summary0002196: Non-ASCII character in comment makes macro fail silently
DescriptionA copyright symbol in a comment in macro causes the macro to do nothing at all when run. No error message or other output is generated.
Steps To ReproduceRun this macro. Nothing happens.
Replace the © by (c). The macro runs and creates an object as expected.



# Copyright © 2015 Richard P. Parkins, M. A.
# All dimensions in millimeters
tol = 0.2 # clearance tolerance in mm
size = 10.0 # one little cube
small = 6.0 # size of hole

import Part
from FreeCAD import Base
import FreeCADGui
if App.ActiveDocument == None:
    App.newDocument()
    App.setActiveDocument("Unnamed")
    App.ActiveDocument=App.getDocument("Unnamed")
    Gui.ActiveDocument=Gui.getDocument("Unnamed")

v1 = Base.Vector(- size / 2, - size / 2, 0)
b1 = Part.makeBox(size, size, size, v1)
v1 = Base.Vector((2 * tol - small) * 0.707, 0, size + small - tol)
v2 = Base.Vector(1, 1, 0)
b2 = Part.makeBox(small - 2 * tol, small - tol, small - 2 * tol, v1, v2)
v1 = Base.Vector(size / 2, (- small) * 0.707, size / 2)
v2 = Base.Vector(0, 1, 1)
b3 = Part.makeBox(small, small, small, v1, v2)
c1 = FreeCAD.ActiveDocument.addObject("Part::Feature","c1")
c1.Shape = b1.fuse(b2).cut(b3)
Gui.updateGui()
TagsNo tags attached.
FreeCAD Information

Activities

rparkins

2015-07-20 13:10

reporter   ~0006256

It does generate an error message to the Report View, but I didn't have that window wisible. In any case complaining about characters in comments is not necessary or useful.

yorik

2015-08-05 02:33

administrator   ~0006274

This is not a bug but a feature of python. You need to add this line at the beginning of your script (the very first line):

# -*- coding: utf8 -*-

(or any other encoding if you use another one)

Issue History

Date Modified Username Field Change
2015-07-20 11:12 rparkins New Issue
2015-07-20 13:10 rparkins Note Added: 0006256
2015-08-05 02:33 yorik Note Added: 0006274
2015-08-05 02:33 yorik Status new => closed
2015-08-05 02:33 yorik Assigned To => yorik
2015-08-05 02:33 yorik Resolution open => no change required
2015-08-05 02:33 yorik Fixed in Version => 0.16