New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: clipboard functions windows 10 py3.5 #14362

Closed
chris-b1 opened this Issue Oct 6, 2016 · 1 comment

Comments

Projects
None yet
4 participants
@chris-b1
Contributor

chris-b1 commented Oct 6, 2016

This seems to work ok in the current version of pyperclip, but is broken in our vendored version, so likely just need to update.

https://github.com/asweigart/pyperclip
asweigart/pyperclip#41

# Your code here
In [1]: df = pd.DataFrame(np.random.randn(10, 2))

In [2]: df.to_clipboard()
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-2-1f8b11f0ff98> in <module>()
----> 1 df.to_clipboard()

c:\users\chris\documents\python-dev\pandas\pandas\core\generic.py in to_clipboard(self, excel, sep, **kwargs)
   1236         """
   1237         from pandas.io import clipboard
-> 1238         clipboard.to_clipboard(self, excel=excel, sep=sep, **kwargs)
   1239 
   1240     def to_xarray(self):

c:\users\chris\documents\python-dev\pandas\pandas\io\clipboard.py in to_clipboard(obj, excel, sep, **kwargs)
     96     else:
     97         objstr = str(obj)
---> 98     clipboard_set(objstr)

c:\users\chris\documents\python-dev\pandas\pandas\util\clipboard.py in _copyWindows(text)
     83                                  len(text.encode('utf-16-le')) + 2)
     84     pchData = d.kernel32.GlobalLock(hCd)
---> 85     ctypes.cdll.msvcrt.wcscpy(ctypes.c_wchar_p(pchData), text)
     86     d.kernel32.GlobalUnlock(hCd)
     87     d.user32.SetClipboardData(CF_UNICODETEXT, hCd)

OSError: exception: access violation writing 0x0000000000000000

In [4]: pd.read_clipboard()
<segfault>

Output of pd.show_versions()

# Paste the output here ## INSTALLED VERSIONS

commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.19.0+5.g855357b
nose: 1.3.7
pip: 8.1.2
setuptools: 23.0.0
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.0
statsmodels: 0.6.1
xarray: None
IPython: 5.1.0
sphinx: 1.3.1
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: 1.0.0
tables: None
numexpr: 2.6.0
matplotlib: 1.5.3
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: 0.9.3
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None

@jorisvandenbossche jorisvandenbossche added this to the 0.20.0 milestone Oct 6, 2016

@gfyoung

This comment has been minimized.

Show comment
Hide comment
@gfyoung

gfyoung Oct 21, 2016

Member

FWIW, I'm getting this exception too as far back as 0.18.1.

Member

gfyoung commented Oct 21, 2016

FWIW, I'm getting this exception too as far back as 0.18.1.

@jreback jreback closed this in 4a1a330 Nov 18, 2016

@jreback jreback modified the milestones: 0.19.2, 0.20.0 Nov 18, 2016

amolkahat added a commit to amolkahat/pandas that referenced this issue Nov 26, 2016

BUG in clipboard (linux, python2) with unicode and separator (GH13747)
vendered updated version of Pyperclip

closes #13747
closes #14362
closes #12807
closes #12529

Author: Ajay Saxena <ajasaxen@Ajays-MacBook-Pro.local>
Author: Ajay Saxena <aileronajay@gmail.com>

Closes #14599 from aileronajay/master and squashes the following commits:

2aafb66 [Ajay Saxena] moved comment inside test and added github issue labels to test
b74fbc1 [Ajay Saxena] ignore lint test for pyperclip files
9db42d8 [Ajay Saxena] whatsnew conflict
1dca292 [Ajay Saxena] conflict resolution
98b61e8 [Ajay Saxena] merge conflict
cedb690 [Ajay Saxena] merge conflict in whats new file
7af95da [Ajay Saxena] merging lastest changes
ac8ae60 [Ajay Saxena] skip clipboard test if clipboard primitives are absent
b03ed56 [Ajay Saxena] changed whatsnew file
c0aafd7 [Ajay Saxena] Merge branch 'test_branch'
9946fb7 [Ajay Saxena] Merge branch 'master' of https://github.com/pandas-dev/pandas into test_branch
ed1375f [Ajay Saxena] Merge branch 'test_branch'
0665fd4 [Ajay Saxena] fixed linting and test case as per code review
d202fd0 [Ajay Saxena] added test for valid encoding, modified setup.py so that pandas/util/clipboard can be found
dd57ae3 [Ajay Saxena] code review changes and read clipboard invalid encoding test
71d58d0 [Ajay Saxena] testing encoding in kwargs to to_clipboard and test case for the same
02f87b0 [Ajay Saxena] removed duplicate files
825bbe2 [Ajay Saxena] all files related to pyperclip are under pandas.util.clipboard
c5a87d8 [Ajay Saxena] Merge branch 'test_branch' of https://github.com/aileronajay/pandas into test_branch
f708c2e [Ajay Saxena] Merge branch 'master' of https://github.com/aileronajay/pandas
d565b1f [Ajay Saxena] updated pyperclip to the latest version
14d94a0 [Ajay Saxena] changed the pandas util clipboard file to return unicode if the python version is 2, else str
66d8ebf [Ajay Saxena] removed the disabled tag for clipboard test so that we can check if they pass after this change
edb8553 [Ajay Saxena] refactored the new unicode test to be in sync with the rest of the file
c83d000 [Ajay Saxena] added test case for unicode round trip
fb922d6 [Ajay Saxena] changes for GH 13747

jorisvandenbossche added a commit to jorisvandenbossche/pandas that referenced this issue Dec 14, 2016

BUG in clipboard (linux, python2) with unicode and separator (GH13747)
vendered updated version of Pyperclip

closes #13747
closes #14362
closes #12807
closes #12529

Author: Ajay Saxena <ajasaxen@Ajays-MacBook-Pro.local>
Author: Ajay Saxena <aileronajay@gmail.com>

Closes #14599 from aileronajay/master and squashes the following commits:

2aafb66 [Ajay Saxena] moved comment inside test and added github issue labels to test
b74fbc1 [Ajay Saxena] ignore lint test for pyperclip files
9db42d8 [Ajay Saxena] whatsnew conflict
1dca292 [Ajay Saxena] conflict resolution
98b61e8 [Ajay Saxena] merge conflict
cedb690 [Ajay Saxena] merge conflict in whats new file
7af95da [Ajay Saxena] merging lastest changes
ac8ae60 [Ajay Saxena] skip clipboard test if clipboard primitives are absent
b03ed56 [Ajay Saxena] changed whatsnew file
c0aafd7 [Ajay Saxena] Merge branch 'test_branch'
9946fb7 [Ajay Saxena] Merge branch 'master' of https://github.com/pandas-dev/pandas into test_branch
ed1375f [Ajay Saxena] Merge branch 'test_branch'
0665fd4 [Ajay Saxena] fixed linting and test case as per code review
d202fd0 [Ajay Saxena] added test for valid encoding, modified setup.py so that pandas/util/clipboard can be found
dd57ae3 [Ajay Saxena] code review changes and read clipboard invalid encoding test
71d58d0 [Ajay Saxena] testing encoding in kwargs to to_clipboard and test case for the same
02f87b0 [Ajay Saxena] removed duplicate files
825bbe2 [Ajay Saxena] all files related to pyperclip are under pandas.util.clipboard
c5a87d8 [Ajay Saxena] Merge branch 'test_branch' of https://github.com/aileronajay/pandas into test_branch
f708c2e [Ajay Saxena] Merge branch 'master' of https://github.com/aileronajay/pandas
d565b1f [Ajay Saxena] updated pyperclip to the latest version
14d94a0 [Ajay Saxena] changed the pandas util clipboard file to return unicode if the python version is 2, else str
66d8ebf [Ajay Saxena] removed the disabled tag for clipboard test so that we can check if they pass after this change
edb8553 [Ajay Saxena] refactored the new unicode test to be in sync with the rest of the file
c83d000 [Ajay Saxena] added test case for unicode round trip
fb922d6 [Ajay Saxena] changes for GH 13747

(cherry picked from commit 4a1a330)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment