AttributeError: 'set' object has no attribute 'set_all'

Hi Community,
I’m a truely new user for fenics. There are some promblem when i got using this software:The script is as follows

Mark boundary domains

boundaries = FacetFunction(‘double’, mesh, mesh.topology().dim()-1)
boundaries={0,1}
boundaries.set_all(0)
left.mark(boundaries, 1)
top.mark(boundaries, 2)
right.mark(boundaries, 3)
bottom.mark(boundaries, 4)
center.mark(boundaries, 5)

When I try to run the script, it tell me the function “FacetFunction” is not defined.
so I changed FacetFunction into MeshFunction.however a new error occured as follows

Traceback (most recent call last):
File “/home/ts313/Documents/phasefield/NHKTYPE1-DENS.py”, line 87, in
boundaries.set_all(0)
AttributeError: ‘set’ object has no attribute ‘set_all’

I don’t know how to fix this trouble.Sincerely appreciate for any help

First of all, you need to supply which version of FEniCS you are using (from the look of the code, you are running a version prior to 2017.2.0).
Secondly, you should use 3x` encapsulation to properly format code.

Finally, you are overwriting boundaries, which is the causing your error:

[quote="liuzherui, post:1, topic:7890"]
boundaries = FacetFunction(‘double’, mesh, mesh.topology().dim()-1)
boundaries={0,1}
[/quote]
you should rename the second variable here.

Thanks for your help.
I installed the fenics2016.2.0 on ubuntu 16.04. It finally worked very well.