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

Does not work with 3.10 #3

Open
sobolevn opened this issue Dec 9, 2021 · 2 comments
Open

Does not work with 3.10 #3

sobolevn opened this issue Dec 9, 2021 · 2 comments

Comments

@sobolevn
Copy link

sobolevn commented Dec 9, 2021

This line causes an error: https://github.com/lensvol/astboom/blob/master/astboom/visualizers/st.py#L1

» astboom ast < out/ex.py
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/mypy/.venv/bin/astboom", line 5, in <module>
    from astboom.cli import cli
  File "/Users/sobolev/Desktop/mypy/.venv/lib/python3.10/site-packages/astboom/cli.py", line 10, in <module>
    from astboom.visualizers.st import VisualizeST
  File "/Users/sobolev/Desktop/mypy/.venv/lib/python3.10/site-packages/astboom/visualizers/st.py", line 1, in <module>
    import parser
ModuleNotFoundError: No module named 'parser'

Even on 3.9 this import is raising a warning: DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python

@lensvol
Copy link
Owner

lensvol commented Dec 9, 2021

Thank you for reporting this! I will try to do something about this shortly.

@povilasb
Copy link

povilasb commented May 3, 2022

This works to me on Python 3.10.1:

diff --git a/astboom/visualizers/st.py b/astboom/visualizers/st.py
index 851f2c3..71b9c4e 100644
--- a/astboom/visualizers/st.py
+++ b/astboom/visualizers/st.py
@@ -1,5 +1,3 @@
-import parser
-import symbol
 import token

 from astboom.visualizers.base import BaseVisualizer
@@ -10,6 +8,7 @@ def decode(code):
     if code < 256:
         return token.tok_name[code]
     else:
+        import symbol
         return symbol.sym_name[code]


@@ -26,6 +25,7 @@ class VisualizeST(BaseVisualizer):
         return result

     def process(self, source):
+        import parser
         st = parser.suite(source)
         source_tree = st.totuple()
         return {decode(source_tree[0]): self.display(source_tree[1:])}

I guess those imports could be optional?
Say I'm not even using st visualizer :)

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

3 participants