Ok Carlos, this does not surprise me as I have encountered similar issues:
http://code.google.com/p/spyderlib/source/detail?r=0282cbd8f5f036bfb6254b235a5f9d9594128129
Socket communication fails during startup on "slow" machines (at least
I have never seen this bug on my different machines at work, and I see
it on a quite slow machine at home). And with these bugs, this refresh
plugin line was part of the traceback too.

You certainly have noticed the "#XXX Is it a good idea?" comment that
I wrote a long time ago when building the plugin interface. Honestly
I'm not sure to remember why exactly this could be a bad idea but I
think it had something to do with to many 'refresh_plugin' calls
leading to an inefficient implementation.

Now, commenting this line could be the solution. But the best solution
may be to disable this refresh_plugin method during Spyder's startup
-- with a timer or something like that.

-Pierre

2011/10/16 Carlos Córdoba <[email protected]>:
> I think I've found one reason for these tracebacks. They seem to happen
> during the initialization of plugins and they're generated by trying to
> refresh the plugins too early during startup, which is done here:
>
> diff -r 4b43639efb69 spyderlib/plugins/__init__.py
> --- a/spyderlib/plugins/__init__.py    dom oct 16 15:06:11 2011 +0200
> +++ b/spyderlib/plugins/__init__.py    dom oct 16 11:59:05 2011 -0500
> @@ -195,7 +195,8 @@ class SpyderPluginMixin(object):
>         if self.DISABLE_ACTIONS_WHEN_HIDDEN:
>             toggle_actions(self.plugin_actions, visible)
>         if visible:
> -            self.refresh_plugin() #XXX Is it a good idea?
> +            #self.refresh_plugin() #XXX Is it a good idea?
> +            pass
>         self.isvisible = enable and visible
>
>     def set_option(self, option, value):
>
> If I comment that line, then the tracebacks doesn't happen anymore (at least
> I didn't see any after several hours of work)
>
> Cheers,
> Carlos
>
> El 11/09/11 11:57, Carlos Córdoba escribió:
>>
>> I'm getting this traceback from time to time, in a kind of random,
>> unpredictable fashion (at least for me):
>>
>> Traceback (most recent call last):
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 297, in keyPressEvent
>>    self.postprocess_keyevent(event)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 777, in postprocess_keyevent
>>    ShellBaseWidget.postprocess_keyevent(self, event)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 352, in postprocess_keyevent
>>    self._key_tab()
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 809, in _key_tab
>>    self.show_code_completion(automatic=False)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 941, in show_code_completion
>>    obj_list = self.get_module_completion(text)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/externalshell/pythonshell.py",
>> line 121, in get_module_completion
>>    return self.ask_monitor("getmodcomplist('%s')" % objtxt)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/externalshell/pythonshell.py",
>> line 72, in ask_monitor
>>    return communicate(sock, command, settings=settings)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/utils/bsdsocket.py",
>> line 56, in communicate
>>    return read_packet(sock)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/utils/bsdsocket.py",
>> line 31, in read_packet
>>    dlen, = struct.unpack("l", datalen)
>> struct.error: unpack requires a string argument of length 8
>>
>> Sometimes this is accompanied of this other traceback:
>>
>> Traceback (most recent call last):
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/plugins/inspector.py",
>> line 366, in refresh_plugin
>>    self.set_object_text(None, force_refresh=False)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/plugins/inspector.py",
>> line 529, in set_object_text
>>    found = self.show_help(text, ignore_unknown=ignore_unknown)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/plugins/inspector.py",
>> line 698, in show_help
>>    if self.shell.is_defined(obj_text):
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/externalshell/pythonshell.py",
>> line 114, in is_defined
>>    % (objtxt, force_import))
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/externalshell/pythonshell.py",
>> line 73, in ask_monitor
>>    return communicate(sock, command, settings=settings)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/utils/bsdsocket.py",
>> line 56, in communicate
>>    return read_packet(sock)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/utils/bsdsocket.py",
>> line 34, in read_packet
>>    data += sock.recv(dlen)
>> OverflowError: signed integer is greater than maximum
>>
>> and other times it only appears this one:
>>
>> Traceback (most recent call last):
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 297, in keyPressEvent
>>    self.postprocess_keyevent(event)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 777, in postprocess_keyevent
>>    ShellBaseWidget.postprocess_keyevent(self, event)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 352, in postprocess_keyevent
>>    self._key_tab()
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 809, in _key_tab
>>    self.show_code_completion(automatic=False)
>>  File
>> "/home/carlos/.virtualenvs/spyder_trunk/lib/python2.7/site-packages/spyderlib/widgets/shell.py",
>> line 986, in show_code_completion
>>    b_k_g = dir(__builtin__)+self.get_globals_keys()+keyword.kwlist
>> TypeError: can only concatenate list (not "NoneType") to list
>>
>> This is happening to me from some time now, I don't remember exactly since
>> when.
>>
>> All these tracebacks seem to imply that monitor communication channels are
>> somehow shutdown, which breaks code completion. But how this can happen and
>> be fixed?
>>
>> 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.

Reply via email to