diff --git a/src/python/PyBis/pybis/pybis.py b/src/python/PyBis/pybis/pybis.py
index 348f84ec4aac44605c0014b95980e3305ee3b3b5..75a670f1b2cce5cc97eabeb3d1069ed5a3d9d932 100644
--- a/src/python/PyBis/pybis/pybis.py
+++ b/src/python/PyBis/pybis/pybis.py
@@ -3039,6 +3039,8 @@ class AttrHolder():
                     raise KeyError("This {}Type has auto-generated code. You cannot set a code".format(self.entity))
             except KeyError:
                 pass
+            except TypeError:
+                pass
 
             self.__dict__['_code'] = value
 
@@ -3435,6 +3437,9 @@ class Space(OpenBisObject):
     def new_project(self, code, description=None, **kwargs):
         return self.openbis.new_project(self.code, code, description, **kwargs)
 
+    def new_sample(self, **kwargs):
+        return self.openbis.new_sample(space=self, **kwargs)
+
     def delete(self, reason):
         self.openbis.delete_entity('Space', self.permId, reason)
         print("Space {} has been sucessfully deleted.".format(self.permId))
diff --git a/src/python/PyBis/tests/test_sample.py b/src/python/PyBis/tests/test_sample.py
index 037bf018be8ac06d5658a5592ca59546be46d226..cb1089363422ed1a336fa796faed4c7f5f801a18 100644
--- a/src/python/PyBis/tests/test_sample.py
+++ b/src/python/PyBis/tests/test_sample.py
@@ -46,6 +46,9 @@ def test_create_delete_sample(space):
 
     sample.delete('sample creation test on '+timestamp)
 
+def test_create_delete_sample(space):
+    o=space.openbis
+
 
 def test_parent_child(space):
     o=space.openbis