0

I am currently doing an automation where I have to copy data to clipboard from UI and read that data from clipboard. I am using pywinauto for UI automation and app.XXXX.menu_select('Export-> to Clipboard') is the command I use to copy data both the times to clipboard.

I am using pandas read_clipboard to read data from clipboard twice,from the same UI but in two different functions. It executes normally for the first time, but in second function , the old data is read again. I tried clearing the clipboard data using below code:

    from ctypes import windll
    if windll.user32.OpenClipboard(None):
      windll.user32.EmptyClipboard()
      windll.user32.CloseClipboard()

It clears the clipboard, but then I get empty data error for the second read_clipboard.

pandas.io.common.EmptyDataError: No columns to parse from file

This is the code I use, both times:

    df=pandas.read_clipboard(sep="\t",
                   header=0)

What is the possible solution for this issue?

Vincy Mathew
  • 121
  • 1
  • 4
  • 16

0 Answers0