Take the 2-minute tour ×

I am using Python(x,y) 2.7. I write code either in Spyder or using Eclipse+Pydev. When I am trying to getting list of Python modules, Spyder IDE is giving different result than Eclipse+Pydev. Code is simple

import sys as s
print s.modules.keys() 

Spyder gives proper module names like

 ['matplotlib._tri', 'numpy.core.info', 'dicom.os', 'matplotlib.artist',...etc.

Eclipse+Pydev gives result like

['copy_reg', 'sre_compile', 'locale', '_sre', 'functools', 'encodings', 'site', 'builtin', 'sysconfig', 'operator', 'main', 'types', 'encodings.encodings', 'sphinxcontrib', 'msvcrt', 'abc', 'enthought', '_weakrefset', 'errno', 'encodings.codecs', 'sre_constants', 'imp', '_abcoll', 'ntpath', '_codecs', 'new', 'nt', '_warnings', 'genericpath', 'stat', 'zipimport', 'encodings.builtin', 'warnings', 'UserDict', 'encodings.cp1252', 'sys', 'codecs', 're', 'os.path', '_functools', 'getpass', '_locale', 'sitecustomize', 'signal', 'traceback', 'linecache', 'encodings.aliases', 'exceptions', 'sre_parse', 'os', '_weakref']

Why this difference ? Any knowledge material/reference would be great. Is there any way to get same result given by Spyder ?

share|improve this question
add comment

1 Answer

One of Spyder's primary design goals is to make interactive scientific computing as painless as possible. To facilitate that, by default Spyder launches a custom-tailored interactive Python session at startup. It achieves this customization by setting an environment variable called PYTHONSTARTUP which specifies the path to a script that will be executed at interpreter startup. You can control this setting under Preferences...Console...Advanced settings. By default, Spyder points to scientific_startup.py, which imports a whole host of scientific modules and functions directly into the main namespace so that quick, interactive exploration is easy.

I suppose you could configure PyDev to load the same scientific startup script by setting the same environment variable under the Interpreter Configuration settings. PyDev would, however, use this startup script for every Python interpreter, and that may not be what you intend to do all the time, especially if you are using PyDev to develop Python applications.

Note that, for any script in the Spyder editor, you can control whether it will be executed in the current interactive Python interpreter or in a separate, dedicated Python interpreter that does not use the scientific startup script. Use the Run Setting dialog (hit F6). Sometimes you want to keep executing your script over and over in the same interactive session, but other times (like developing a GUI app) you want each script execution to happen in a clean Python session that does not have a bunch of extra scientific functions in the main namespace.

share|improve this answer
Good and detail explanation –  purnendumaity May 15 '13 at 17:47
add comment

Your Answer


