diff --git a/modules/gfx/pymod/export_entity.cc b/modules/gfx/pymod/export_entity.cc
index 78dd67f09d990983f4ccffffdf7ba37eb3758617..c17fe7b3dcde4a9efb9cc58d6f1e47dbdad72160 100644
--- a/modules/gfx/pymod/export_entity.cc
+++ b/modules/gfx/pymod/export_entity.cc
@@ -241,6 +241,11 @@ RenderOptionsPtr ent_ltrace_opts(Entity* ent)
 
 void set_selection(Entity* ent, object sel)
 {
+  object none;
+  if (sel==none) {
+    ent->SetSelection(ent->GetView().CreateEmptyView());
+    return;
+  }
   try {
     String sel_string=extract<String>(sel);
     ent->SetSelection(ent->GetView().Select(sel_string));