ubaldot / vim-conda-activate

Activate Conda environments in Vim.
https://www.vim.org/scripts/script.php?script_id=6074
BSD 3-Clause "New" or "Revised" License
18 stars 0 forks source link

Fatal Error Triggered when trying to open some kinds of files. #9

Closed YZircon closed 1 year ago

YZircon commented 1 year ago

Hi, Your extension is great! It works perfectly with the language server. When I found it, I couldn't help but start using it immediately.

However, when I try to open some files using the right-click menu "Edit with Vim", I get some fatal errors with the error message shown here (Translation: Error triggered while processing Vim\vimfiles\pack\dist\opt\vim-conda-activate\plugin\conda.vim[63]..function 20_SetEnvVariablesWin. Line 65: E1266: A serious error was encountered while initializing Python3. Please check your Python3 installation). A simple example is the file name "_vimrc", which is the same as the name of Vim's configuration file on the Windows operating system. In addition to this, names such as "condafuncs.vim" will trigger the same error. Is there any way to fix it?

YZircon commented 1 year ago

OK, I found out why the problem was triggered. The plugin came into the base conda environment when it started, which was Python 3.9.15, but my Vim was compiled using Python 3.11. So there was an error that "AssertionError: SRE module mismatch", which was caused by the mismatch of the Python Version.

After I upgraded my Python in the base conda environment to version 3.11, the error was fully solved.

May I submit a pull request for this error in your README so that the others who are trying to use your fantastic extension will not meet the same error?

ubaldot commented 1 year ago

Glad that you solved it. I think that the fact that the python version used to compile Vim and the one used by the user should match it is a known fact but it may be good to remark. Sure, make a PR.

YZircon commented 1 year ago

Glad that you solved it. I think that the fact that the python version used to compile Vim and the one used by the user should match it is a known fact but it may be good to remark. Sure, make a PR.

You're right, it definitely a known fact. The reason I met this problem is that I didn't realize that with the plugin enabled, my Vim would start from a virtual environment.

I have already mentioned it in my PR, thank you again for your time.

ubaldot commented 1 year ago

Closed in https://github.com/ubaldot/vim-conda-activate/pull/10