gnebehay / parser

A simple parser for mathematical expressions.
MIT License
169 stars 17 forks source link

AttributeError: module 'parser' has no attribute 'TokenType' #6

Closed Brollof closed 3 years ago

Brollof commented 3 years ago

Running: python compute.py '2*(3+4)' produces error: import parser Traceback (most recent call last): File "compute.py", line 7, in <module> parser.TokenType.T_PLUS: operator.add, AttributeError: module 'parser' has no attribute 'TokenType'

gnebehay commented 3 years ago

This works fine on my machine. Could you double check that the code you are running is identical to what is on Github? What I can also imagine is that there might be another module called parser on your python path and this is somehow shadowing the parser module that comes with this repository.

theRealProHacker commented 1 year ago

I think the problem might be that there is a name collision with the std lib parser module. Maybe you should consider renaming the module to something like math_parser which resolves the name conflict and is also clearer on what the module actually does.