From c75b32f22bd23d86e3401d5fbd49bc40e0dcb076 Mon Sep 17 00:00:00 2001 From: ming <2052760@tongji.edu.cn> Date: Fri, 17 Jan 2025 19:47:44 +0800 Subject: [PATCH 1/2] Fix issue #23497 --- spyder/plugins/projects/plugin.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spyder/plugins/projects/plugin.py b/spyder/plugins/projects/plugin.py index 7748d6adbe0..0d1af556ab3 100644 --- a/spyder/plugins/projects/plugin.py +++ b/spyder/plugins/projects/plugin.py @@ -290,7 +290,13 @@ def on_mainwindow_visible(self): # Open project passed on the command line or reopen last one. cli_options = self.get_command_line_options() initial_cwd = self._main.get_initial_working_directory() - + connection_file = cli_options.connection_file + + # Avoid conflicts with `--connect-to-kernel` option. See issue #23497 + # for more information. + if connection_file is not None: + return + if cli_options.project is not None: logger.debug('Opening project from the command line') project = osp.normpath( From 7dee169aebd6826160db291f24efe29f2ee41602 Mon Sep 17 00:00:00 2001 From: ming <2052760@tongji.edu.cn> Date: Fri, 17 Jan 2025 19:51:42 +0800 Subject: [PATCH 2/2] format code --- spyder/plugins/projects/plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spyder/plugins/projects/plugin.py b/spyder/plugins/projects/plugin.py index 0d1af556ab3..5e298c1f5b5 100644 --- a/spyder/plugins/projects/plugin.py +++ b/spyder/plugins/projects/plugin.py @@ -291,12 +291,12 @@ def on_mainwindow_visible(self): cli_options = self.get_command_line_options() initial_cwd = self._main.get_initial_working_directory() connection_file = cli_options.connection_file - - # Avoid conflicts with `--connect-to-kernel` option. See issue #23497 + + # Avoid conflicts with `--connect-to-kernel` option. See issue #23497 # for more information. if connection_file is not None: return - + if cli_options.project is not None: logger.debug('Opening project from the command line') project = osp.normpath(