Page 3 of 3

Re: plugin CudaFormatter + its formatters

Posted: 06.03.2026 06:48
by dima8101
main Alexey wrote: 04.03.2026 16:45 when plugin error occurs, usually it is a plugin crash, so see the Console panel for crash (red) lines there ...
An error occurs when auto-formatting a python file. The file is not auto-formatted.
When auto-formatting a C++ file, no errors occur at all. The file is not auto-formatted. However, the status bar displays [AStyle (C++)] Cannot format text.

The content of the cuda__astyle_format.cfg file

Code: Select all

--style=google --indent=spaces=4 --suffix=none
Python file formatting error log:

Code: Select all

Traceback (most recent call last):
  File "/home/user/.config/cudatext/py/cuda_fmt/__init__.py", line 258, in on_save_pre
    run_format(ed_self, func, '['+caption+'] ', True)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.config/cudatext/py/cuda_fmt/fmtrun.py", line 210, in run_format
    text = do_format(text1)
  File "/home/user/.config/cudatext/py/cuda_fmt_python_reindent/__init__.py", line 8, in do_reindent
    r.run()
    ~~~~~^^
  File "/home/user/.config/cudatext/py/cuda_fmt_python_reindent/reindent.py", line 203, in run
    for _token in tokens:
                  ^^^^^^
  File "/usr/lib/python3.14/tokenize.py", line 592, in _generate_tokens_from_c_tokenizer
    raise e from None
  File "/usr/lib/python3.14/tokenize.py", line 588, in _generate_tokens_from_c_tokenizer
    for info in it:
                ^^
  File "<string>", line 70
    sys.exit(1)
               ^
IndentationError: unindent does not match any outer indentation level
ERROR: Exception in CudaText for on_save_pre: IndentationError: unindent does not match any outer indentation level (line 70, offset 16): 'sys.exit(1)'

Re: plugin CudaFormatter + its formatters

Posted: 06.03.2026 11:56
by main Alexey
First about Python error. It occurs in module cuda_fmt_python_reindent, which is separate addon:
Formatter for Python: ReIndent

can you uninstall it yet as temp solution?
I will see why AStyle formatter dont work.

Re: plugin CudaFormatter + its formatters

Posted: 06.03.2026 12:03
by main Alexey
I have Win10 with Python 3.14.2.
Installed formatter for Python: ReIndent.
it works here ok on this file:

Code: Select all

if TEXT_OS == 'linux':
    import subprocess
    try:
        LSB_RELEASE = subprocess.check_output('cat /etc/lsb-release', shell=True).decode('utf-8')
        if ("Ubuntu" in LSB_RELEASE or "Debian" in LSB_RELEASE) and (TEXT_CPU == 'amd64'):
            DEBIAN_UBUNTU = True
    except:
        pass
maybe it crashes on specific Py script? can you give me minimal example?

Re: plugin CudaFormatter + its formatters

Posted: 06.03.2026 12:14
by main Alexey
Now about AStyle formatter. You have Python 3.14. Formatter is based on 'pyastyle' lib. I asked Qwen AI:

>Python PyAStyle library from https://pypi.org/project/pyastyle/#files - does it work under Python 3.14 on Linux x64?

Reply:
Short Answer: No, pyastyle does not work under Python 3.14 on Linux x64 — and it is very unlikely to work without significant modifications.

Why It Won't Work Out-of-the-Box:

- Abandoned Project: The GitHub repository (https://github.com/timonwong/pyastyle) has had no commits since December 2015
GitHub
. The project is effectively unmaintained.

- C Extension Compatibility Issues: pyastyle is a C extension module wrapping the Artistic Style C++ library. Python 3.14 introduced significant C API changes, including:
New configuration API (PEP 741)
www.c-sharpcorner.com
Free-threading/GIL-related changes (PEP 703)
Python
Extension modules must now be audited for multiple-interpreter compatibility
Python

- No Source Build Guarantee: Even if you attempt to build from the source distribution (pyastyle-1.1.5.zip), you would need:
A working C/C++ toolchain on Linux x64
Python 3.14 development headers
Likely manual patches to handle deprecated/removed C API functions
--------------

so sorry, AStyle formatter is not working for you and for me. Maybe I will remove it.
if you need some C++ formatter, I maybe will try to make one from 'clang' tool. No promise.