Skip to content

Commit 478ab56

Browse files
mbkupferluckyvs1
authored andcommitted
patch wsl compatibility (pandas-dev#38546)
1 parent e3eafc4 commit 478ab56

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

doc/source/whatsnew/v1.3.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ I/O
242242
- Bug in :func:`read_csv` raising ``IndexError`` with multiple header columns and ``index_col`` specified when file has no data rows (:issue:`38292`)
243243
- Bug in :func:`read_csv` not accepting ``usecols`` with different length than ``names`` for ``engine="python"`` (:issue:`16469`)
244244
- Bug in :func:`read_csv` raising ``TypeError`` when ``names`` and ``parse_dates`` is specified for ``engine="c"`` (:issue:`33699`)
245+
- Bug in :func:`read_clipboard`, :func:`DataFrame.to_clipboard` not working in WSL (:issue:`38527`)
245246
- Allow custom error values for parse_dates argument of :func:`read_sql`, :func:`read_sql_query` and :func:`read_sql_table` (:issue:`35185`)
246247
- Bug in :func:`to_hdf` raising ``KeyError`` when trying to apply
247248
for subclasses of ``DataFrame`` or ``Series`` (:issue:`33748`).

pandas/io/clipboard/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import contextlib
4646
import ctypes
4747
from ctypes import c_size_t, c_wchar, c_wchar_p, get_errno, sizeof
48+
import distutils.spawn
4849
import os
4950
import platform
5051
import subprocess
@@ -521,9 +522,8 @@ def determine_clipboard():
521522
return init_windows_clipboard()
522523

523524
if platform.system() == "Linux":
524-
with open("/proc/version") as f:
525-
if "Microsoft" in f.read():
526-
return init_wsl_clipboard()
525+
if distutils.spawn.find_executable("wslconfig.exe"):
526+
return init_wsl_clipboard()
527527

528528
# Setup for the MAC OS X platform:
529529
if os.name == "mac" or platform.system() == "Darwin":

0 commit comments

Comments
 (0)