Amazon Virtual Desktop: python script unable to fetch Clipboard : Access denied

Question:

Amazon Virtual Desktop,

Python Script doing good stuff But unable to access data from clipboard

We have no access for C Drive and available D drive for users data

Trying the following snippet :-

import win32clipboard

# get clipboard data
win32clipboard.OpenClipboard()
data = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()
print data

Gives me following error :-

win32clipboard.OpenClipboard() pywintypes.error: (5, 'OpenClipboard', 'Access is denied.')

Any work around or solution for it ??

Asked By: Vishal G

||

Answers:

Have a look at : https://wiki.python.org/moin/TkInter

#from Tkinter import Tk    # Python v2.x
from tkinter import Tk    # Python v3.x
tkint = Tk()
copied_val = tkint.clipboard_get()
Answered By: Nishutosh Sharma