mixt
mixt copied to clipboard
Invalid syntax (Python 3.10 issue)
Hello, thanks for this amazing package. When trying to run this using python 3.10 I first get some errors about collections.Iterator that are easily fixed, but then I got this :
$ python -m mixt.examples.simple
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.10/runpy.py", line 157, in _get_module_details
code = loader.get_code(mod_name)
File "<frozen importlib._bootstrap_external>", line 1017, in get_code
File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/max/projects/mixt/src/mixt/examples/simple.py", line 29
print(render_example())
SyntaxError: invalid syntax
However this code works (but only standalone, it's not working inside a django app...) :
# coding: mixt
from mixt import html, Element
def Test():
return <div>Hello world</div>
print(Test())
Here is the error
File "/home/max/projects/myapp/components/Footer.py", line 6
return (html.P()("Hello world", ))
SyntaxError: invalid syntax
I had the same issue when executing with the python cmd, but for some reason it works if I use the mixt cmd,
eg: mixt ./example.py
I think it has to do with these headers like '# coding: mixt' found at the top, which I believe is ignored on windows...