rihardsp
rihardsp

Reputation: 64

Where do i put the config file for flake8 on Windows?

I installed flake8 to do some work from home on my windows machine, but don't know where to put my configuration file.

The documentation states, that the flake8 file has to be put in ~/.config/flake8.

I tried %USERPROFILE%/.config/flake8 and simply %USERPROFILE%/flake8 both to no avail. Perhaps, anyone with experience with working with flake8 on Windows can answer this?

Upvotes: 3

Views: 4521

Answers (1)

Mike Driscoll
Mike Driscoll

Reputation: 33111

If you open up the source code for flake8 (main.py), you will see that on Windows, the default config path is significantly different than it is on Linux:

if sys.platform.startswith('win'):
    DEFAULT_CONFIG = os.path.expanduser(r'~\.flake8')

On my Windows 7 machine, that resolves to: C:\Users\username\.flake8

So you'll have to create a file called .flake8. Be sure it begins with a period. I did that by opening up the command line and going to my home folder and executing the following command:

NUL > .flake8

That created the blank file as you can't create it in Explorer (or I couldn't anyway). Once that's created, you can open it and add whatever you like to it.

UPDATE - I finally found some "documentation" that mentions Windows here:

Upvotes: 2

Related Questions