Skip to content

BUG : Check for and Use QApplication instance : clipboard #14372

Closed
@rahulporuri

Description

@rahulporuri

reading data from clipboard fails on Linux because pandas doesn't check if there's already a QApplication running - https://github.com/pydata/pandas/blob/master/pandas/util/clipboard.py#L247

import pandas

pandas.read_clipboard()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-4c32fab697e6> in <module>()
----> 1 pandas.read_clipboard()

/home/rporuri/.canopy/envs/User/lib/python2.7/site-packages/pandas/io/clipboard.pyc in read_clipboard(**kwargs)
     15     parsed : DataFrame
     16     """
---> 17     from pandas.util.clipboard import clipboard_get
     18     from pandas.io.parsers import read_table
     19     text = clipboard_get()

/home/rporuri/.canopy/envs/User/lib/python2.7/site-packages/pandas/util/clipboard.py in <module>()
    245     elif qtBindingInstalled:
    246         _functions = 'PyQt4 module'  # for debugging
--> 247         app = QtGui.QApplication([])
    248         cb = QtGui.QApplication.clipboard()
    249         paste = _pasteQt

RuntimeError: A QApplication instance already exists. 

Output of pd.show_versions()

## INSTALLED VERSIONS

commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-31-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_IN

pandas: 0.18.0
nose: 1.3.7
pip: 8.1.2
setuptools: 23.1.0
Cython: 0.24
numpy: 1.10.4
scipy: 0.17.1
statsmodels: 0.6.1
xarray: None
IPython: 4.1.2
sphinx: 1.4.1
patsy: 0.4.1
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.6.0
matplotlib: 1.5.1
openpyxl: 2.3.4
xlrd: None
xlwt: None
xlsxwriter: None
lxml: 3.6.0
bs4: 4.4.1
html5lib: 0.999
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO DataIO issues that don't fit into a more specific label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions