Sublime Forum

Sublime version different in plugin than in console

#1

I am using pycharm to develop a plugin in sublime text 4 and I added inside the AutomateBrowser.py following code:

print('Python version used: '+sys.version)

Resulting Python version used: 3.3.6 (default, Feb 25 2020, 13:56:07) [MSC v.1600 64 bit (AMD64)]

WHILE if I do this on the console

sys.version

Results

‘3.8.8 (default, Mar 10 2021, 13:30:47) [MSC v.1915 64 bit (AMD64)]’

1 Like

#2

The sublime console runs in the plugin_host-3.8 environment, while plugins by default run in the plugin_host-3.3 environment. To make your plugin run in 3.8, create a file called .python-version with the content 3.8 in your package’s root folder.

See: https://www.sublimetext.com/docs/api_environments.html

2 Likes