Spyder: Error when trying to print source code - AttributeError: 'QPrintDialog' object has no attribute 'addEnabledOption'

Created on 27 Jul 2017  ·  3Comments  ·  Source: spyder-ide/spyder

Description

I want to print a source code file. When I go to File->Print in Spyder I see the error message that I presume is linked to this in some manner.

What steps will reproduce the problem?

It doesn't seem reproducible in that I've now closed and re-opened the file and the print function works as expected. To get this issue I opened the source file, and then I highlight items near the top of the file like "from utilities import *" and right-clicked on utilities to choose go to definition, as I wanted to also view those files. I then went to File->Print and this error was generated. I can't supply any of the files for commericial-in-confidence reasons.

What is the expected output? What do you see instead?
I expected to see a file dialog, instead I got the error below.

Please provide any additional information below

File "C:\Users\fra256\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyderplugins\editor.py", line 1932, in print_file
printDialog.addEnabledOption(QAbstractPrintDialog.PrintSelection)
AttributeError: 'QPrintDialog' object has no attribute 'addEnabledOption'

Version and main components

  • Spyder Version: 3.2.0
  • Python Version: 3.6.0
  • Qt Versions: 5.6.2, PyQt5 5.6 on Windows

Dependencies

pyflakes >=0.6.0 :  1.5.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.1.3 (OK)
pandas >=0.13.1  :  0.19.2 (OK)
numpy >=1.7      :  1.11.3 (OK)
sphinx >=0.6.6   :  1.5.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.9.0 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
sympy >=0.7.3    :  1.0 (OK)
cython >=0.21    :  0.25.2 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
IPython >=4.0    :  5.1.0 (OK)
pylint >=0.25    :  1.6.4 (OK)

Editor Bug

All 3 comments

Thanks for reporting. We'll fix this error in Spyder 3.2.1

@dalthviz, please take a look at this problem.

Hi @neilsf1975 , could you test if the fix works for you?

He meant pull request #4830.

Was this page helpful?
0 / 5 - 0 ratings