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

Crash when importing swig module #1168

Closed
spyder-bot opened this issue Feb 17, 2015 · 9 comments
Closed

Crash when importing swig module #1168

spyder-bot opened this issue Feb 17, 2015 · 9 comments

Comments

@spyder-bot
Copy link
Collaborator

From pieter.e...@gmail.com on 2012-10-06T06:02:36Z

spyderlib crashes when importing a module using

from testlib import *

The crash does not occur when using:

import testlib

The crash only occurs when running spyderlib, from the command line code runs fine. A 'hello world' example is attached.

The problem is due to a special variable cvar that is generated by SWIG for global variables. The crash also occurs when using

from testlib import cvar

System: Ubuntu 12.04, SWIG Version 2.0.4, Python 2.7.3, spyderlib: various versions, latest tested: Spyder 2.1.9

Attachment: bug.py test.h test.cpp test.i

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1168

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2012-10-08T10:09:24Z

Are you seeing a traceback when Spyder crashes?

Summary: Crash when importing swig module
Labels: -Priority-Medium Priority-High Cat-SpyderGUI

@spyder-bot
Copy link
Collaborator Author

From pieter.e...@gmail.com on 2012-10-08T10:53:52Z

There is no traceback.

What happens is that after the "from xxx import *" command spyder freezes. (the entire user interface). By killing the python console I am working in (using another terminal) I can make spyder respond again and continue working by creating a new console. The problem occurs both with the python and ipython console.

@spyder-bot
Copy link
Collaborator Author

From pieter.e...@gmail.com on 2012-10-08T10:59:13Z

As an addition to the previous comment: after killing the console, I get the following message from the internal console:

Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license" for more information.

Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/namespacebrowser.py", line 315, in refresh_table
communicate(sock, "refresh()")
File "/usr/lib/python2.7/dist-packages/spyderlib/utils/bsdsocket.py", line 67, in communicate
return read_packet(sock)
File "/usr/lib/python2.7/dist-packages/spyderlib/utils/bsdsocket.py", line 36, in read_packet
dlen, = struct.unpack("l", datalen)
struct.error: unpack requires a string argument of length 8

@spyder-bot
Copy link
Collaborator Author

From pieter.e...@gmail.com on 2012-10-08T11:00:44Z

And from the console itself:

Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Imported NumPy 1.6.1, SciPy 0.9.0, Matplotlib 1.1.1rc
Type "scientific" for more details.

from oalib import *
cvar
Swig global variables (NO_VALUE, NARRAYS_MAX)

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/monitor.py", line 564, in run
self.update_remote_view()
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/monitor.py", line 445, in update_remote_view
remote_view = make_remote_view(ns, settings, more_excluded_names)
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/monitor.py", line 65, in make_remote_view
more_excluded_names=more_excluded_names)
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/monitor.py", line 54, in get_remote_data
excluded_names=excluded_names)
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/dicteditorutils.py", line 236, in globalsfilter
filters=filters))
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/dicteditorutils.py", line 201, in is_supported
if not is_editable_type(value):
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/dicteditorutils.py", line 114, in is_editable_type
return get_color_name(value) not in (UNSUPPORTED_COLOR, CUSTOM_TYPE_COLOR)
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/dicteditorutils.py", line 103, in get_color_name
np_dtype = get_numpy_dtype(value)
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/dicteditorutils.py", line 40, in get_numpy_dtype
return obj.dtype.type
NameError: Unknown C global variable

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2012-10-10T09:14:57Z

Crucial info, thanks a lot for taking the time to dig into this issue and send us your findings. It seems to be a problem with our monitor, i.e. a socket server used to obtain code completions and other helpful things from the external python process.

Your crash could be related to issue #1106 (which we fixed just a couple of weeks ago). In the meantime, you could try to deactivate the monitor to see if that prevents the crash. To do it please go to:

Tools > Preferences > Console > Introspection

And uncheck the option "Enable monitor".

Please keep us posted to know if this fixes the problem.

@spyder-bot
Copy link
Collaborator Author

From pieter.e...@gmail.com on 2012-10-11T07:46:48Z

Changing the option in Tools->Prefereces->Console->Introspection did not help.

However, on a different machine I checked with the latest branch and the problem did not occur there.

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2012-11-04T13:14:08Z

Could you please try to upgrade from v2.1.9 to latest stable v2.1.11?

I suspect that this revision 6c7945f97adb may have fixed this bug.

@spyder-bot
Copy link
Collaborator Author

From pieter.e...@gmail.com on 2012-11-05T07:06:49Z

On the latest stable version (2.1.11) the problem does not occur any more, I think the bug can be closed.

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2012-11-05T07:16:00Z

Status: Done

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

No branches or pull requests

1 participant