Skip to content
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

Spyder crashes with Python 3.5 and pyqt4 if there are no existing configuration files #3009

Closed
cy18 opened this issue Feb 26, 2016 · 4 comments
Labels
Milestone

Comments

@cy18
Copy link
Contributor

cy18 commented Feb 26, 2016

I'm using the master branch of Spyder. It seems some update broke the auto-completion of the editor so I deleted the configuration files in %HOME%/.spyder-py3. Then the spyder can not be launched.

The error is

AttributeError: 'NoneType' object has no attribute 'dockwidget'

and it occurs at several places in spyder\spyderlib\app\spyder.py

I did some dirty patch on the spyder.py, and it works. Then I reset the file to the origin file and it's still working. So I think the problem only occurs when there are no configuration files, i.e. %HOME%/.spyder-py3 .

What steps will reproduce the problem?

  1. Delete %HOME%/.spyder-py3
  2. run spyder by python3 bootstrape.py
  3. Spyder crash due to the exception AttributeError: 'NoneType' object has no attribute 'dockwidget'

Please provide any additional information below
Since I'm not familiar with the source code of Spyder, I don't think it's a good idea to submit a pull request. Just FYI, the modification I have done is

1396c1396,1397
<         self.tabifyDockWidget(first.dockwidget, second.dockwidget)

---
>         if first is not None and second is not None:
>             self.tabifyDockWidget(first.dockwidget, second.dockwidget)
1600c1601
<                 if first_row is not None and second_row is not None:

---
>                 if first_row[0] is not None and second_row[0] is not None:
1613,1614c1614,1616
<                 row[0].dockwidget.show()
<                 row[0].dockwidget.raise_()

---
>                 if row[0] is not None:
>                     row[0].dockwidget.show()
>                     row[0].dockwidget.raise_()
1650,1661c1652,1664
<                 dockwidget = widget.dockwidget
<                 dock_min_h = dockwidget.minimumHeight()
<                 dock_max_h = dockwidget.maximumHeight()
<                 info = {'widget': widget,
<                         'dock min height': dock_min_h,
<                         'dock max height': dock_max_h}
<                 self._layout_widget_info.append(info)
<                 # The 0.95 factor is to adjust height based on usefull
<                 # estimated area in the window
<                 new_height = int(layout['height fraction'][c][r]*height*0.95)
<                 dockwidget.setMinimumHeight(new_height)
<                 dockwidget.setMaximumHeight(new_height)

---
>                 if widget is not None:
>                     dockwidget = widget.dockwidget
>                     dock_min_h = dockwidget.minimumHeight()
>                     dock_max_h = dockwidget.maximumHeight()
>                     info = {'widget': widget,
>                             'dock min height': dock_min_h,
>                             'dock max height': dock_max_h}
>                     self._layout_widget_info.append(info)
>                     # The 0.95 factor is to adjust height based on usefull
>                     # estimated area in the window
>                     new_height = int(layout['height fraction'][c][r]*height*0.95)
>                     dockwidget.setMinimumHeight(new_height)
>                     dockwidget.setMaximumHeight(new_height)

Versions and main components

  • Spyder Version: master branch
  • Python Version: 3.5
  • Operating system: Windows 10

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:

jedi >=0.8.1;<0.9.0: 0.9.0 (NOK)
matplotlib >=1.0 : 1.5.0 (OK)
nbconvert >=4.0 : None (NOK)
numpy >=1.7 : 1.10.4 (OK)
pandas >=0.13.1 : 0.17.0 (OK)
pep8 >=0.6 : 1.6.2 (OK)
pyflakes >=0.6.0 : None (NOK)
pygments >=1.6 : 2.0.2 (OK)
pylint >=0.25 : 1.4.3 (OK)
qtconsole >=4.0 : 4.1.0 (OK)
rope >=0.9.4 : None (NOK)
sphinx >=0.6.6 : None (NOK)
sympy >=0.7.3 : 0.7.7.dev (OK)

By the way, the reason I'm using PyQt4 is because there are no PyQt5 available for Python 3.5 yet.

@epifanio
Copy link

it happen on OSX as well:

$ python3 bootstrap.py
Executing Spyder from source checkout
Revision 1a00213, Branch: master
01. Patched sys.path with /Users/epi/dev/spyder
02. PyQt5 is detected, selecting
03. Imported Spyder 3.0.0dev
    [Python 3.5.1 64bits, Qt 5.5.1, PyQt5 5.5.1 on Darwin]
04. Running Spyder
Bootstrap completed in 00:00:00.8769
Traceback (most recent call last):
  File "/Users/epi/dev/spyder/spyderlib/app/spyder.py", line 3096, in main
    mainwindow = run_spyder(app, options, args)
  File "/Users/epi/dev/spyder/spyderlib/app/spyder.py", line 2982, in run_spyder
    main.setup()
  File "/Users/epi/dev/spyder/spyderlib/app/spyder.py", line 1189, in setup
    self.setup_layout(default=False)
  File "/Users/epi/dev/spyder/spyderlib/app/spyder.py", line 1410, in setup_layout
    self.setup_default_layouts('default', settings)
  File "/Users/epi/dev/spyder/spyderlib/app/spyder.py", line 1601, in setup_default_layouts
    self.splitDockWidget(first_row[0].dockwidget,
AttributeError: 'NoneType' object has no attribute 'dockwidget'

The patch provided fixed the error.

jedi >=0.8.1;<0.9.0:  None (NOK)
matplotlib >=1.0   :  1.5.1 (OK)
nbconvert >=4.0    :  4.1.0 (OK)
numpy >=1.7        :  1.10.4 (OK)
pandas >=0.13.1    :  0.17.1 (OK)
pep8 >=0.6         :  None (NOK)
psutil >=0.3       :  None (NOK)
pyflakes >=0.6.0   :  None (NOK)
pygments >=1.6     :  2.1 (OK)
pylint >=0.25      :  None (NOK)
qtconsole >=4.0    :  4.1.1 (OK)
rope >=0.9.4       :  None (NOK)
sphinx >=0.6.6     :  None (NOK)
sympy >=0.7.3      :  None (NOK)

@ccordoba12 ccordoba12 modified the milestones: v3.0beta3, v3.0beta4 Feb 27, 2016
@jitseniesen
Copy link
Member

I managed to reproduce this on Linux. It seems to have something to do with sphinx. The following configuration is fine (meaning that spyder will start even when there are no existing configuration files):

jedi >=0.8.1    :  None (NOK)
matplotlib >=1.0:  None (NOK)
nbconvert >=4.0 :  4.1.0 (OK)
numpy >=1.7     :  None (NOK)
pandas >=0.13.1 :  None (NOK)
pep8 >=0.6      :  None (NOK)
psutil >=0.3    :  None (NOK)
pyflakes >=0.6.0:  None (NOK)
pygments >=1.6  :  2.1.1 (OK)
pylint >=0.25   :  None (NOK)
qtconsole >=4.0 :  4.1.1 (OK)
rope >=0.9.4    :  None (NOK)
sphinx >=0.6.6  :  1.3.5 (OK)
sympy >=0.7.3   :  None (NOK)

However, if I uninstall sphinx then spyder crashes if started without configuration files.

If sphinx is not installed, help_plugin = self.help in setup_default_layouts is None, and this causes the problem as I understand it. I don't know what to do about this; is sphinx supposed to be a hard dependency now?

@ccordoba12
Copy link
Member

@jitseniesen, thanks for helping us to figure this problem out. Yes, Sphinx is now a required dependency of Spyder (not an optional one), so this is where this problem is coming from. The only optional dependencies are now: Matplotlib, Pandas, Numpy and Sympy.

However, I'll do the required changes to avoid this ugly crash.

@ccordoba12 ccordoba12 changed the title Spyder crashes on windows with Python 3.5 and pyqt4 if there are no existing configuration files Spyder crashes with Python 3.5 and pyqt4 if there are no existing configuration files Mar 6, 2016
@ccordoba12
Copy link
Member

Ok, so my solution was this: Now Spyder crashes in a very clear way if Sphinx can't be found.

That should make clear to all our users that Sphinx is now a hard dependency :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants