def send2trash(path): try: f = Gio.File.new_for_path(path) f.trash(cancellable=None) except GObject.GError as e: raise OSError(e.message)