set_python_interpreter.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:sublimeTextConfig 作者: luoye-fe 项目源码 文件源码
def update_interpreter_settings(self, venv_path: str) -> None:
        """Updates the project and adds/modifies the Venv path"""
        project_data = self.get_project_data()

        # Check if have settings set in the project settings
        if project_data.get('settings', False):

            try:
                # Try to get the python_interpreter key
                project_data['settings'].get('python_interpreter', False)
            except AttributeError:
                # If this happens that mean your settings is a sting not a dict
                sublime.message_dialog(
                    'Ops your project settings is missed up'
                )
            else:
                # Set the path and save the project
                project_data['settings']['python_interpreter'] = venv_path
                self.save_project_data(project_data)
        else:
            # This will excute if settings key is not in you project settings
            project_data.update(
                {
                    'settings': {'python_interpreter': venv_path}
                }
            )
            self.save_project_data(project_data)
            AnacondaSetPythonBuilder().update_interpreter_build_system(
                venv_path
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号