Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid syntax (Python 3.10 issue) #54

Open
mjal opened this issue Oct 9, 2022 · 2 comments
Open

Invalid syntax (Python 3.10 issue) #54

mjal opened this issue Oct 9, 2022 · 2 comments

Comments

@mjal
Copy link

mjal commented Oct 9, 2022

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
@mjal
Copy link
Author

mjal commented Oct 9, 2022

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

@mjal mjal changed the title Invalid syntax Invalid syntax (Python 3.10 issue) Oct 9, 2022
@reedjones
Copy link

reedjones commented May 5, 2023

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants