Skip to content

Register $data\Lib\python3x as site directory. #6255

@deathaxe

Description

@deathaxe

Problem description

Python packages such as pywin32 ship with <name>.pth files to register custom sub directories to sys.path to enable contained modules to be imported.

Such files are evaluated for site-packages directories, only.

ST does not seem to treat $data/Lib/python<version> directories as site-packages even though those are intended to be target for installing 3rd-party python packages (via Package Control or PIP).

As a result, *.pth files are not evaluated and packages relying on them don't work as expected.

see: https://docs.python.org/2/library/site.html

Note: $data is a synonym for ST's data directory (e.g.: ~/.config/sublime-text).

Preferred solution

Configure python interpreter to use $data/Lib/python<version> as site-package, so it evaluates .pth files, when starting.

Alternatives

Some kind of loader module (or once again a 0_package_control.sublime-package per python-version) was needed to register the paths.

A plugin with following content makes plugin_hosts load .pth files and fixes packages such as pywin32.

import site
site.addsitedir("$data/Lib/python38")

Additional Information

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions