How to use the hou.ui.copyTextToClipboard() ?

   2835   2   0
User Avatar
Member
83 posts
Joined: Dec. 2005
Offline
How to use the hou.ui.copyTextToClipboard() ?


The following error occurred:

Qt Error: OleSetClipboard: Failed to set mime data (NULL) on clipboard: COM error 0xffffffff800401f0 CO_E_NOTINITIALIZED (Unknown error 0x0ffffffff800401f0) ()
Qt Error: OleSetClipboard: Failed to set mime data (text/plain) on clipboard: COM error 0xffffffff800401f0 CO_E_NOTINITIALIZED (Unknown error 0x0ffffffff800401f0) ()
User Avatar
Staff
4438 posts
Joined: July 2005
Offline
From the error message I would assume that function uses relies on a per-thread initialization function being called before it can be used. When you run python code from a python shell, it doesn't run on the main thread. It runs on a separate thread where the per-thread initialization function has not been called. If you run the same code on the main thread (as part of a shelf tool for example), where the initialization function has been called, it should work.
User Avatar
Member
83 posts
Joined: Dec. 2005
Offline
Thank you very much!
  • Quick Links