vigo / textmate2-python-fmt

Python FMT is a python linter/formatter/checker for TextMate.
MIT License
13 stars 5 forks source link

No module named 'astroid' #3

Open tiktuk opened 4 years ago

tiktuk commented 4 years ago

I get the following error when running Python-FMT:

Screenshot 2020-01-15 at 00 10 53

It still does reformat my code though. And I can also import astroid in python manually.

And thanks for making it btw ☺️ !

vigo commented 3 years ago

Hi. Here is what I do, I create a virtualenv (I love virtualenvwrapper) for the project i'm working on it right? then I install all the requirements + linter packages such as pylint, flake8 etc... Then, i create .tm_properties to the root of project folder.

TM_PYTHON_FMT_VIRTUAL_ENV="/Users/YOURNAME/.virtualenvs/YOURENVNAME"
TM_PYTHON_FMT_PYTHON_PATH="${TM_PYTHON_FMT_VIRTUAL_ENV}/bin/python"
TM_PYTHON_FMT_PYLINTRC="/Users/vigo/Repos/Development/Python/web_apps/MYPROJECT/.pylintrc"

this sets required environment variables. YOURNAME is your login name, YOURENVNAME is the name of your virtual environment.

Let's say there is no project, you have ony a single file right? At this point, I also have another virtualenv called "textmate" and all of the requirements are installed to that environment. I also fix the $PATH in the TextMate's prefs/variables:

PATH /Users/vigo/.virtualenvs/textmate/bin:$PATH

This helps for global usage. If you have .tm_properties on your workind directory, bundle respects those environment variables. If not, bundle checks the TextMate's $PATH etc... ok?