Comments (4)
That output doesn't look like it comes from Black itself. Are you sure the bug is not in some editor integration that is invoking Black?
from black.
Thanks for your quick response. Thats correct, its the output from vscode when I execute black through the editor. If I run black in the console, I get the same error message (with less formatting):
python -m black n:\network\path\to\python\file.py
Traceback (most recent call last):
File "C:\Users\USR\Anaconda\envs\PKG\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\USR\Anaconda\envs\PKG\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\black\__main__.py", line 3, in <module>
patched_main()
File "src\black\__init__.py", line 1601, in patched_main
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\click\core.py", line 1077, in main
with self.make_context(prog_name, args, **extra) as ctx:
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\click\core.py", line 943, in make_context
self.parse_args(ctx, args)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\click\core.py", line 1408, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\click\core.py", line 2400, in handle_parse_result
value = self.process_value(ctx, value)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\click\core.py", line 2362, in process_value
value = self.callback(ctx, self, value)
File "src\black\__init__.py", line 139, in read_pyproject_toml
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\black\files.py", line 109, in find_pyproject_toml
path_project_root, _ = find_project_root(path_search_start, stdin_filename)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\black\files.py", line 98, in find_project_root
pyproject_toml = _load_toml(directory / "pyproject.toml")
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\black\files.py", line 48, in _load_toml
return tomllib.load(f)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 66, in load
return loads(s, parse_float=parse_float)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 102, in loads
pos = key_value_rule(src, pos, out, header, parse_float)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 326, in key_value_rule
pos, key, value = parse_key_value_pair(src, pos, parse_float)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 369, in parse_key_value_pair
pos, value = parse_value(src, pos, parse_float)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 616, in parse_value
return parse_array(src, pos, parse_float)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 420, in parse_array
pos, val = parse_value(src, pos, parse_float)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 620, in parse_value
return parse_inline_table(src, pos, parse_float)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 445, in parse_inline_table
pos, key, value = parse_key_value_pair(src, pos, parse_float)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 369, in parse_key_value_pair
pos, value = parse_value(src, pos, parse_float)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 598, in parse_value
return parse_one_line_basic_str(src, pos)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 409, in parse_one_line_basic_str
return parse_basic_str(src, pos, multiline=False)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 575, in parse_basic_str
pos, parsed_escape = parse_escapes(src, pos)
File "C:\Users\USR\Anaconda\envs\PKG\lib\site-packages\tomli\_parser.py", line 494, in parse_basic_str_escape
raise suffixed_err(src, pos, "Unescaped '\\' in a string") from None
tomli.TOMLDecodeError: Unescaped '\' in a string (at line 9, column 22)
from black.
That sounds like you have a syntax error in your pyproject.toml.
from black.
Thats it, I didn't catch that. Sorry for the confusion.
from black.
Related Issues (20)
- AttributeError: module 'black' has no attribute 'Mode'. Did you mean: 'mode'? HOT 1
- Unrelated testcases fail when total number of tests is increased beyond 367 HOT 3
- problematic formatting: indentation change in docstring HOT 7
- How to skip reformatting of Heroku files? HOT 4
- Crash on formatting `case case` syntax when line length set to be small HOT 2
- Style suggestiong: allow aligned dict values HOT 1
- Black cannot parse valid code HOT 2
- INTERNAL ERROR: Black produced invalid code: f-string: expecting '}' HOT 1
- GitHub Action: Option to parse version from pyproject.toml
- When reformatting a triple-quote string, black fails with an INTERNAL ERROR: Black produced code that is not equivalent to the source
- Empty line and `...` and "unindent does not match any outer indentation level" HOT 4
- #myomin
- Incorrectly strips tuple brackets from single entry tuple
- Standalone comments still partially broken
- Black keeps reformatting some code chunks back and forth between 2 different representations HOT 6
- line-length is not working as intended HOT 1
- newline after opening braces causes parser error HOT 1
- Docstrings not part of a function are incorrectly labeled as non-equivalent code HOT 1
- A bug when replacing quote variations HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from black.