Giter Site home page Giter Site logo

Comments (4)

JelleZijlstra avatar JelleZijlstra commented on May 23, 2024

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.

Nerrror avatar Nerrror commented on May 23, 2024

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.

JelleZijlstra avatar JelleZijlstra commented on May 23, 2024

That sounds like you have a syntax error in your pyproject.toml.

from black.

Nerrror avatar Nerrror commented on May 23, 2024

Thats it, I didn't catch that. Sorry for the confusion.

from black.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.