Ok, I see what it is. When the workspace is not defined, the model is not installed in Project Explorer's tree view, so the only thing to do is to check if self.model() is not None before trying to get the persistent index list.
Fixed in my local repo. I'll push changes soon. -Pierre Le 29 août 2011 à 23:45, "Carlos Córdoba" <[email protected]> a écrit : > Hi Pierre, > > The problem seems to be generated when you've never used the project explorer > to actually create a workspace. I haven't used the project explorer until now > because I was working on simple scripts, but after creating a workspace the > problem disappeared. > > The problem also disappears with the suggestion you gave me, i.e. changing > self.model() to self.proxymodel > > Cheers, > Carlos > > El 29/08/11 02:50, Pierre Raybaut escribió: >> Hi Carlos, >> >> Apparently, the project explorer's tree view has no model which is >> very weird (its model should be an instance of >> spyderlib.widgets.explorer.ProxyModel). >> >> And is everything seems ok regarding the project explorer's behavior >> during runtime? >> You may test the following: replace 'self.model()' by >> 'self.proxymodel' here: >> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/ >> spyderlib/widgets/explorer.py", >> line 636, in save_expanded_state >> >> -Pierre >> >> On Aug 29, 6:06 am, Carlos Córdoba<[email protected]> wrote: >>> Hi, >>> >>> I'm getting this traceback while closing Spyder: >>> >>> Traceback (most recent call last): >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/spyder.py", >>> line 1156, in closeEvent >>> if self.closing(True): >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/spyder.py", >>> line 1180, in closing >>> if not widget.closing_plugin(cancelable): >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/plugins/projectexplorer.py", >>> line 97, in closing_plugin >>> self.save_config() >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/plugins/projectexplorer.py", >>> line 126, in save_config >>> self.set_option('expanded_state', self.treewidget.get_expanded_state()) >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/explorer.py", >>> line 625, in get_expanded_state >>> self.save_expanded_state() >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/explorer.py", >>> line 636, in save_expanded_state >>> for idx in self.model().persistentIndexList(): >>> AttributeError: 'NoneType' object has no attribute 'persistentIndexList' >>> Error in atexit._run_exitfuncs: >>> Traceback (most recent call last): >>> File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs >>> func(*targs, **kargs) >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/spyder.py", >>> line 1180, in closing >>> if not widget.closing_plugin(cancelable): >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/plugins/projectexplorer.py", >>> line 97, in closing_plugin >>> self.save_config() >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/plugins/projectexplorer.py", >>> line 126, in save_config >>> self.set_option('expanded_state', self.treewidget.get_expanded_state()) >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/explorer.py", >>> line 625, in get_expanded_state >>> self.save_expanded_state() >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/explorer.py", >>> line 636, in save_expanded_state >>> for idx in self.model().persistentIndexList(): >>> AttributeError: 'NoneType' object has no attribute 'persistentIndexList' >>> Error in sys.exitfunc: >>> Traceback (most recent call last): >>> File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs >>> func(*targs, **kargs) >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/spyder.py", >>> line 1180, in closing >>> if not widget.closing_plugin(cancelable): >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/plugins/projectexplorer.py", >>> line 97, in closing_plugin >>> self.save_config() >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/plugins/projectexplorer.py", >>> line 126, in save_config >>> self.set_option('expanded_state', self.treewidget.get_expanded_state()) >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/explorer.py", >>> line 625, in get_expanded_state >>> self.save_expanded_state() >>> File >>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/explorer.py", >>> line 636, in save_expanded_state >>> for idx in self.model().persistentIndexList(): >>> AttributeError: 'NoneType' object has no attribute 'persistentIndexList' >>> >>> Cheers, >>> Carlos > > -- > You received this message because you are subscribed to the Google Groups > "spyder" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/spyderlib?hl=en. > -- You received this message because you are subscribed to the Google Groups "spyder" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
