[Python-modules-team] Bug#852308: [jupyter-qtconsole]

Jean-Sébastien Kroll-Rabotin jean-sebastien.kroll-rabotin at univ-lorraine.fr
Mon Jan 23 13:15:43 UTC 2017


Package: jupyter-qtconsole
Version: 4.2.1-3
Severity: normal

Dear Maintainer,

Clicking on the "Print" menu item of QtConsole interface leads to a
crash with the following error:
> Traceback (most recent call last):
>   File "/usr/lib/python3/dist-packages/qtconsole/console_widget.py",
> line 747, in print_ printer = QtGui.QPrinter()
> AttributeError: module 'PyQt5.QtWidgets' has no attribute 'QPrinter'

Since it is apparently due to referring to obsolete module organization
when loading python modules to support printing, the follwing patch
seems to fix the issue:

--- /usr/lib/python3/dist-packages/qtconsole/console_widget.py.bak 2017-01-23 12:02:59.704432492 +0100
+++ /usr/lib/python3/dist-packages/qtconsole/console_widget.py 2017-01-23 12:11:55.789095501 +0100
@@ -12,6 +12,7 @@
 import webbrowser from qtconsole.qt import QtCore, QtGui
+from PyQt5 import QtPrintSupport
 
 from traitlets.config.configurable import LoggingConfigurable
 from qtconsole.rich_text import HtmlExporter
@@ -744,8 +745,8 @@
         """ Print the contents of the ConsoleWidget to the specified QPrinter.
         """
         if (not printer):
-            printer = QtGui.QPrinter()
-            if(QtGui.QPrintDialog(printer).exec_() != QtGui.QDialog.Accepted):
+            printer = QtPrintSupport.QPrinter()
+            if(QtPrintSupport.QPrintDialog(printer).exec() != QtGui.QDialog.Accepted): return self._control.print_(printer)


After applying such changes, test runs to print to a PDF file have been
successful.

Regards,

J.-S. Kroll-Rabotin


-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages jupyter-qtconsole depends on:
ii  jupyter-core       4.2.1-1
ii  python3-qtconsole  4.2.1-3
pn  python3:any        <none>

jupyter-qtconsole recommends no packages.

jupyter-qtconsole suggests no packages.

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: Signature digitale OpenPGP
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20170123/a772591c/attachment-0001.sig>


More information about the Python-modules-team mailing list