Search code examples
pythonpython-2.7parser-generatorwaxeye

Wrong import of waxeye parser


So I tried to use parses generator waxeye, but as I try to use tutorial example of program in python using generated parser I get error:

AttributeError: 'module' object has no attribute 'Parser'

Here's part of code its reference to:

import waxeye
import parser

p = parser.Parser()

The last line cause the error. Parser generated by waxeye I put in the same directory as the init.py . It's parser.py .

Anyone have any idea what's wrong with my code?


Edit 20-05-2013:

Beggining of the parser.py file:

from waxeye import Edge, State, FA, WaxeyeParser

class Parser (WaxeyeParser):

Solution

  • It might be that the parser module you're importing is not the one you want.

    Try inserting a:

    print parser.__file__ 
    

    right after the imports, or try naming your parser module differently.

    Also, if working with Python 2.7 its good to enable absolute_imports from the __future__ module.