File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,26 @@ def __is_spyder():
7
7
8
8
9
9
def _spyder_run_setting_is_correct ():
10
- from spyder .config .main import CONF
10
+ try :
11
+ # This is the spyder 3 location
12
+ from spyder .config .main import CONF
13
+ except ImportError :
14
+ # CONF moved in spyder 4
15
+ from spyder .config .manager import CONF
16
+
11
17
# Use this instead of accessing like a dictionary so that a
12
18
# default value can be supplied if the setting is missing.
13
19
return CONF .get ('run' , 'default/interpreter/dedicated' , False )
14
20
15
21
16
22
def _warn_if_spyder_settings_wrong ():
17
- if not _spyder_run_setting_is_correct ():
23
+ from spyder import __version__
24
+ from packaging import version
25
+ pre_4 = version .parse (__version__ ) < version .parse ('4.0.0' )
26
+ # It looks like spyder 4 works fine without this setting, perhaps
27
+ # related to the change that they run files in an empty namespace
28
+ # instead of the namespace of the current console.
29
+ if not _spyder_run_setting_is_correct () and pre_4 :
18
30
print ('\x1b [1;31m**** Please set spyder preference Run to '
19
31
'"Execute in a dedicated console" for the best '
20
32
'vpython experience. ****\x1b [0m' )
You can’t perform that action at this time.
0 commit comments