Python Forum
Copying from windows Clipboard
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Copying from windows Clipboard
#1
hello everybody,
I am new to python and currently working on data anylisis wiith pandas. This morning I copied a companies information from the web and tried to read and print it into my IDE to no avail. I am convinced you will be of help. this is the code I entered,
 
import pandas as pd
from pandas import Series, DataFrame

#example revenue of different companies

revenue_df = pd.read_clipboard();
print(revenue_df)
and this error message keeps coming up.
Error:
C:\Users\fruad\PycharmProjects\example1\venv\Scripts\python.exe C:/Users/fruad/PycharmProjects/example1/DataFrame.py Traceback (most recent call last): File "C:/Users/fruad/PycharmProjects/example1/DataFrame.py", line 1, in <module> import pandas as pd File "C:\Users\fruad\PycharmProjects\example1\venv\lib\site-packages\pandas\__init__.py", line 145, in <module> from pandas.io.api import ( File "C:\Users\fruad\PycharmProjects\example1\venv\lib\site-packages\pandas\io\api.py", line 7, in <module> from pandas.io.clipboards import read_clipboard ImportError: cannot import name 'read_clipboard' from 'pandas.io.clipboards' (C:\Users\fruad\PycharmProjects\example1\venv\lib\site-packages\pandas\io\clipboards.py) Process finished with exit code 1
thanks for your time.
Reply
#2
what version of pandas do you use?
and do you install any optional dependencies for Clipboard I/O
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Apr-17-2020, 09:24 AM)buran Wrote: what version of pandas do you use?
and do you install any optional dependencies for Clipboard I/O
i am using the latest version of python and no i have not installed any optional dependencies for for clipboard I/O. Let me look into that right away.
Reply
#4
It's a bit not clear:
in the installation instruction there are few optional dependencies and they say Clipboard I/O and Clipborad I/O on linux
At the same time in an older version of the docs it says:
Quote:One of qtpy (requires PyQt or PySide), PyQt5, PyQt4, pygtk, xsel, or xclip: necessary to use read_clipboard(). Most package managers on Linux distributions will have xclip and/or xsel immediately available for installation.
and also:
Quote:Note: You may need to install xclip or xsel (with gtk, PyQt5, PyQt4 or qtpy) on Linux to use these methods [read_clipboard].

It's not clear if these are dependencies only for Linux or also on Windows


Sorry, it's my mistake - looking at the docstring in the source code (I cannot find it in the docs) it says:
Quote:On Windows, no additional modules are needed.
On Mac, the pyobjc module is used, falling back to the pbcopy and pbpaste cli
commands. (These commands should come with OS X.).
On Linux, install xclip or xsel via package manager. For example, in Debian:
sudo apt-get install xclip
sudo apt-get install xsel
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020