akalongman / akalongman/sublimetext-codeformatter
bug(htmlbeautifier): Global installed BeaufitulSoup
- 主要语言
- Python
- 星标
- 772
- 派生
- 128
- PR 合并指标
- 30 天内没有已合并 PR
描述
### 1. Summary
**If**:
1. I globally install BeautifulSoup,
1. [**path to `site-packages` folder**](https://kristinita.ru/Programs/KristinitaLuckyLink#environment-variable) add to my local Sublime Text environment,
1. `"formatter_version": "bs4"` in my `"codeformatter_html_options"`.
I can't format any HTML file. I get an error in Sublime Text console:
```python
command: code_formatter
error: CodeFormatter
Format error:
prettify() got an unexpected keyword argument 'indent_size'
```
### 2. Environment
+ Windows 10 Enterprise LTSB 64-bit EN,
+ Python 3.6.4,
+ Sublime Text Build 3143,
+ BeautifulSoup4 4.6.0,
+ CodeFormatter 4.1.0.
### 3. Steps to reproduce
I reproduce the problem in a version of Sublime Text without plugins and user settings.
#### 3.1. Without global site-packages path
I install CodeFormatter → I restart Sublime Text → I print in Sublime Text console:
```python
>>> import sys; sys.path
['D:\\Sublime Text Build 3143 x64 For Debug', 'D:\\Sublime Text Build 3143 x64 For Debug\\python3.3.zip', 'D:\\Sublime Text Build 3143 x64 For Debug\\Data\\Lib\\python3.3', 'D:\\Sublime Text Build 3143 x64 For Debug\\Data\\Packages', 'D:\\SUB044~1\\Data\\Packages\\pyyaml\\st3', 'D:\\Sublime Text Build 3143 x64 For Debug\\Data\\Packages\\CodeFormatter\\codeformatter\\lib', 'D:\\Sublime Text Build 3143 x64 For Debug\\Data\\Packages\\CodeFormatter\\codeformatter\\lib\\htmlbeautifier']
```
#### 3.2. With global site-packages path
See [**manual**](https://stackoverflow.com/a/48321114/5951529), how use global Python packages in Sublime Text environment.
For example, my package [**KristinitaLuckyLink**](http://kristinita.ru/Programs/KristinitaLuckyLink) contains lines:
```python
site_packages = (os.environ['PYTHONPACKAGES'])
if site_packages not in sys.path:
sys.path.append(site_packages)
```
These lines add `'C:\\Python36\\Lib\\site-packages'` path to Sublime Text environment in Sublime Text start.
`Package Control: Add Repository` → I paste `https://github.com/Kristinita/KristinitaLuckyLink` → Enter → `Package Control: Install Package` → I select `KristinitaLuckyLink` → I restart Sublime Text → I print in Sublime Text console:
```python
>>> import sys; sys.path
['D:\\Sublime Text Build 3143 x64 For Debug', 'D:\\Sublime Text Build 3143 x64 For Debug\\python3.3.zip', 'D:\\Sublime Text Build 3143 x64 For Debug\\Data\\Lib\\python3.3', 'D:\\Sublime Text Build 3143 x64 For Debug\\Data\\Packages', 'D:\\SUB044~1\\Data\\Packages\\pyyaml\\st3', 'C:\\Python36\\Lib\\site-packages', 'D:\\Sublime Text Build 3143 x64 For Debug\\Data\\Packages\\CodeFormatter\\codeformatter\\lib', 'D:\\Sublime Text Build 3143 x64 For Debug\\Data\\Packages\\CodeFormatter\\codeformatter\\lib\\htmlbeautifier']
```
Pay attention to `'C:\\Python36\\Lib\\site-packages'`.
---
Then I open any valid HTML file → Ctrl+Shift+P (⌘⇧p for Mac) → `CodeFormatter`.
### 4. Expected behavior
**If no** `'C:\\Python36\\Lib\\site-packages'`
**or**
`"formatter_version": "regexp",` in `User/CodeFormatter.sublime-settings`:
HTML file successful beautify.
### 5. Actual behavior
**Else** `'C:\\Python36\\Lib\\site-packages'`
**and**
`"formatter_version": "bs4",` in `User/CodeFormatter.sublime-settings`:
I get an error:
```python
command: code_formatter
error: CodeFormatter
Format error:
prettify() got an unexpected keyword argument 'indent_size'
```
Thanks.
贡献指南
评估
这个 Issue 还没有评估数据。