From documentation:
assign_syntax(syntax)
Changes the syntax used by the view. syntax may be a Syntax object, packages path to a syntax file, orscope:
specifier string.
But
>>> view.assign_syntax(sublime.find_syntax_by_name('JSON'))
Traceback (most recent call last):
File "__main__", line 1, in <module>
File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime.py", line 1630, in assign_syntax
sublime_api.view_assign_syntax(self.view_id, syntax)
TypeError: String required
>>> view.assign_syntax(sublime.find_syntax_by_name('JSON')[0])
Did I miss something?