Skip to content

BUG: Fix linux clipboard QApplication() creation #14815

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

Closed
wants to merge 1 commit into from

Conversation

pankajp
Copy link
Contributor

@pankajp pankajp commented Dec 7, 2016

A Qt application cannot instantiate multiple QApplication instances,
so we create a new QApplication only when the global
QApplication.instance() is None.

Failing sample (gtk should not be installed for pandas to use qt clipboard):

from PyQt4.QtGui import QApplication
myapp = QApplication([])
from pandas.util.clipboard import clipboard_get  # <--- ERROR

  File "prefix/lib/python2.7/site-packages/pandas/util/clipboard.py", line 164, in <module>

    app = qt4.QtGui.QApplication([])

RuntimeError: A QApplication instance already exists.

Fixes pandas-dev#14372

A Qt application cannot instantiate multiple `QApplication` instances,
so we create a new `QApplication` only when the global
`QApplication.instance()` is None.

Failing sample:

```
from PyQt4.QtGui import QApplication
myapp = QApplication([])
from pandas.util.clipboard import clipboard_get  # <--- ERROR

  File "prefix/lib/python2.7/site-packages/pandas/util/clipboard.py", line 164, in <module>

    app = qt4.QtGui.QApplication([])

RuntimeError: A QApplication instance already exists.

```
@jorisvandenbossche jorisvandenbossche added the IO Data IO issues that don't fit into a more specific label label Dec 7, 2016
@jreback
Copy link
Contributor

jreback commented Dec 7, 2016

this should be addressed upstream

pls file a report with pyoerclip
if it's accepted there then we can merge

@codecov-io
Copy link

codecov-io commented Dec 7, 2016

Current coverage is 85.27% (diff: 0.00%)

Merging #14815 into master will decrease coverage by <.01%

@@             master     #14815   diff @@
==========================================
  Files           144        144          
  Lines         50968      50968          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits          43466      43465     -1   
- Misses         7502       7503     +1   
  Partials          0          0          

Powered by Codecov. Last update 2466ecb...40d70f9

@jreback jreback added this to the 0.20.0 milestone Jan 21, 2017
@jreback
Copy link
Contributor

jreback commented Jan 21, 2017

can you add a whatsnew note (0.20.0)

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments, but can you please file a bug report upstream and link here as well.

@@ -50,7 +50,7 @@ def init_qt_clipboard():
# $DISPLAY should exist
from PyQt4.QtGui import QApplication

app = QApplication([])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment here

@jreback
Copy link
Contributor

jreback commented Mar 20, 2017

thanks!

@jreback jreback closed this in b1e29db Mar 20, 2017
AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this pull request Mar 21, 2017
closes pandas-dev#14372

A Qt application cannot instantiate multiple
`QApplication` instances, so we create a new `QApplication` only when
the global `QApplication.instance()` is None.

Author: Pankaj Pandey <[email protected]>

Closes pandas-dev#14815 from pankajp/patch-2 and squashes the following commits:

40d70f9 [Pankaj Pandey] BUG: Fix linux clipboard QApplication() creation
mattip pushed a commit to mattip/pandas that referenced this pull request Apr 3, 2017
closes pandas-dev#14372

A Qt application cannot instantiate multiple
`QApplication` instances, so we create a new `QApplication` only when
the global `QApplication.instance()` is None.

Author: Pankaj Pandey <[email protected]>

Closes pandas-dev#14815 from pankajp/patch-2 and squashes the following commits:

40d70f9 [Pankaj Pandey] BUG: Fix linux clipboard QApplication() creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Data IO issues that don't fit into a more specific label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG : Check for and Use QApplication instance : clipboard
4 participants