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

Cannot install: No module named 'parser' #49

Open
ClayShoaf opened this issue Mar 4, 2022 · 8 comments
Open

Cannot install: No module named 'parser' #49

ClayShoaf opened this issue Mar 4, 2022 · 8 comments

Comments

@ClayShoaf
Copy link

When I try to install, I get the following output:

[user ~/github/pycscope]$ python setup.py install
Traceback (most recent call last):
  File "/home/user/github/pycscope/setup.py", line 5, in <module>
    from pycscope import __version__
  File "/home/user/github/pycscope/pycscope/__init__.py", line 25, in <module>
    import keyword, parser, symbol, token
ModuleNotFoundError: No module named 'parser'
@ruben2020
Copy link

ruben2020 commented Apr 10, 2022

I think the issue is basically that pycscope cannot be run using Python 3.10 because the parser module has been removed. It works on Python 3.8 and older, though.

@portante
Copy link
Owner

Ugh.

@arkdae
Copy link

arkdae commented Apr 26, 2022

That's not the only thing that is gone in 3.10, so is the symbol module.

@brianphaley
Copy link

Hi Peter!

And at least one new distro (Ubuntu 22.04) is 3.10+ only now ;-( I guess ast is the closest replacement? I might have to start looking at this as I use it every day, until then can generate cscope.out files on an older system.

@portante
Copy link
Owner

Any help you can offer would be great. I have not had a chance to dive into this work for a long time now.

@ruben2020
Copy link

ruben2020 commented Oct 5, 2022

@portante The parser module has been deprecated since Python 3.10. The only way left is the ast (abstract syntax tree) module. However, I think pycscope requires a concrete syntax tree that preserves the original source code, rather than an abstract syntax tree that's lossy. So, instead of using the ast module, you may need something like LibCST.

@ruben2020
Copy link

ruben2020 commented Oct 5, 2022

@portante oh. I'm mistaken. There might be a far simpler way to fix this. Please see this page. The change looks trivial. They simply replaced parser.suite with ast.parse.

@ruben2020
Copy link

ruben2020 commented Oct 7, 2022

@portante I tried it, but it doesn't work. I think the old tuple structure is no longer used. Looks like you have no other choice but to port pycscope to ast or LibCST, which is a huge change to pycscope. It's almost a rewrite I expect. The other alternative is for you to get the old parser and symbol modules' source code from 3.9 and incorporate it into pycscope.

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

5 participants