I have an issue where in i am trying to retrieve object from clipboard modify it and add it back ...
Time and again I keep getting
requested operation on clipboard could not be performed
Looks like the clipboard is being locked by some process, how do I free the clipboard?
You cannot free it. If another app has the clipboard open, you have to wait until it closes it. If the clipboard has been recently (within the past second or two) modified, you should expect that other apps will be opening it for examination, and therefore should expect failures if you expect to be able to open it immediately yourself. You need to use try..except handlers, along with sleep(), and a "3 strikes" loop.
pseudo code: