Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create grammar tables directory #1955

Closed

Conversation

SimonBiggs
Copy link

@SimonBiggs SimonBiggs commented Feb 1, 2021

When importing black as a Python dependency I have been getting the following logging messages:

2021-02-02 09:46:38.074 Generating grammar tables from C:\Users\sbiggs\git\pymedphys\.venv\lib\site-packages\blib2to3\Grammar.txt
2021-02-02 09:46:38.104 Writing grammar tables to C:\Users\sbiggs\AppData\Local\black\black\Cache\20.8b1\Grammar3.7.9.final.0.pickle
2021-02-02 09:46:38.105 Writing failed: [Errno 2] No such file or directory: 'C:\\Users\\sbiggs\\AppData\\Local\\black\\black\\Cache\\20.8b1\\tmpd9fht2r6'
2021-02-02 09:46:38.106 Generating grammar tables from C:\Users\sbiggs\git\pymedphys\.venv\lib\site-packages\blib2to3\PatternGrammar.txt
2021-02-02 09:46:38.108 Writing grammar tables to C:\Users\sbiggs\AppData\Local\black\black\Cache\20.8b1\PatternGrammar3.7.9.final.0.pickle
2021-02-02 09:46:38.109 Writing failed: [Errno 2] No such file or directory: 'C:\\Users\\sbiggs\\AppData\\Local\\black\\black\\Cache\\20.8b1\\tmp9jp7c60o'

I made the changes to the black repo as within this PR, and those messages changed to the following for the first run:

2021-02-02 09:56:35.847 Generating grammar tables from C:\Users\sbiggs\git\pymedphys\.venv\lib\site-packages\blib2to3\Grammar.txt
2021-02-02 09:56:35.879 Writing grammar tables to C:\Users\sbiggs\AppData\Local\black\black\Cache\20.8b2.dev73+g988c686.d20210201\Grammar3.7.9.final.0.pickle
2021-02-02 09:56:35.884 Generating grammar tables from C:\Users\sbiggs\git\pymedphys\.venv\lib\site-packages\blib2to3\PatternGrammar.txt
2021-02-02 09:56:35.888 Writing grammar tables to C:\Users\sbiggs\AppData\Local\black\black\Cache\20.8b2.dev73+g988c686.d20210201\PatternGrammar3.7.9.final.0.pickle

And then subsequently they were gone.


I suspected the issue was that the parent directory for that file didn't exist, so I created it.

@ichard26
Copy link
Collaborator

ichard26 commented Feb 1, 2021

*sighs*, this is the third attempt at removing this error log. The thing is that we don't want Black to affect the environment on import when the caching functionality isn't wanted by the user. I wish I could just say "please ignore that message cause it's normal and expected when Black's cache hasn't been automatically set up yet (probably because it was just installed), it will go away once Black has formatted a file via the CLI", but no of course the world isn't that simple :)

I guess, either getting rid of the logging all together (or some variation where the end user won't see them by default), OR modifying the cache handling for the grammar tables would the best solution. see also #1143

@SimonBiggs
Copy link
Author

Hi @ichard26,

Sorry for adding noise here. Thank you for all your hard work here 🙂

@SimonBiggs SimonBiggs closed this Feb 1, 2021
@SimonBiggs SimonBiggs deleted the create-grammar-pickle-directory branch February 1, 2021 23:31
@ichard26
Copy link
Collaborator

ichard26 commented Feb 1, 2021

Don't worry about that, I wasn't annoyed at you, just at the situation (I mean, COVID is still here so yeah). Thanks a bunch for the thanks! You don't get enough of that in FOSS.

@SimonBiggs
Copy link
Author

(I mean, COVID is still here so yeah)

Yeah... I feel like we live in a little bubble not aware of how hard the rest of the world is having to battle... (I'm in Aus...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants