main Alexey wrote: ↑07.03.2026 08:15
Can you give me example file? To fix the crash.
I took your example.
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
In line 5, I removed two spaces before the second "if". In this case, I get an error.
With installed "formatter Python ReIndent" (Python Black - not installed)
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 5
if ("Ubuntu" in LSB_RELEASE or "Debian" in LSB_RELEASE) and (TEXT_CPU == 'amd64'):
^
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 5, offset 89): 'if ("Ubuntu" in LSB_RELEASE or "Debian" in LSB_RELEASE) and (TEXT_CPU == 'amd64'):'
With installed "formatter Python Black": (Python ReIndent - removed)
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_black/__init__.py", line 82, in do_format
text = black.format_str(text, mode=mode)
File "/home/user/.config/cudatext/py/cuda_fmt_python_black/black/__init__.py", line 1208, in format_str
dst_contents = _format_str_once(src_contents, mode=mode, lines=lines)
File "/home/user/.config/cudatext/py/cuda_fmt_python_black/black/__init__.py", line 1222, in _format_str_once
src_node = lib2to3_parse(src_contents.lstrip(), mode.target_versions)
File "/home/user/.config/cudatext/py/cuda_fmt_python_black/black/parsing.py", line 73, in lib2to3_parse
result = drv.parse_string(src_txt, True)
File "/home/user/.config/cudatext/py/cuda_fmt_python_black/blib2to3/pgen2/driver.py", line 204, in parse_string
return self.parse_tokens(tokens, debug)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/home/user/.config/cudatext/py/cuda_fmt_python_black/blib2to3/pgen2/driver.py", line 129, in parse_tokens
for quintuple in proxy:
^^^^^
File "/home/user/.config/cudatext/py/cuda_fmt_python_black/blib2to3/pgen2/driver.py", line 93, in __next__
token = next(self._tokens)
File "/home/user/.config/cudatext/py/cuda_fmt_python_black/blib2to3/pgen2/tokenize.py", line 748, in generate_tokens
raise IndentationError(
...<2 lines>...
)
File "<tokenize>", line 5
if ("Ubuntu" in LSB_RELEASE or "Debian" in LSB_RELEASE) and (TEXT_CPU == 'amd64'):
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 5, offset 6): 'if ("Ubuntu" in LSB_RELEASE or "Debian" in LSB_RELEASE) and (TEXT_CPU == 'amd64'):'