[python-win32] clipboard errors

Tim Roberts timr at probo.com
Tue Jun 4 18:56:08 CEST 2013


Eric Johansson wrote:
> I'm having a bit of trouble the Windows clipboard. I keep getting things 
> like the trace back below.:
>
> 2013-06-03 12:56:26,667 - DEBUG - VFU TB Traceback (most recent call last):
>    File "C:\NatLink\NatLink\Vocola\extensions\vocola_ext_togglename.py", 
> line 180, in vc_first_unknown
>      clipboard_string = clipboard_instance.clipboard_get()
>    File "C:\NatLink\NatLink\Vocola\extensions\vocola_ext_togglename.py", 
> line 88, in clipboard_get
> result=self.win32clipboard.GetClipboardData(self.win32con.CF_TEXT)
> error: (183, 'GetClipboardData', 'Cannot create a file when that file 
> already exists.')
> ...
> Would appreciate any insight as to why I'm getting these errors.

What is on the clipboard?  This code expects only text data in the
clipboard (CF_TEXT).  If the clipboard contains an image, you'll get an
error.  It may be that a try/except is appropriate here.

The text of the error is a bit misleading.  Error code 183 is
ERROR_ALREADY_EXISTS.  That doesn't necessarily involve a file at all.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list