0

I downloaded pycparser and ran python setup.py install, but whenever I try to run anything, I get:

...
    from .c_parser import CParser
  File "C:\Program Files\Python 3.2\lib\site-packages\pycparser\c_parser.py", line 11, in <module>
    import ply.yacc
ImportError: No module named ply.yacc

What's wrong? I'm pretty sure I followed the Readme exactly...

0 _
  • 10,524
  • 11
  • 77
  • 109
user541686
  • 205,094
  • 128
  • 528
  • 886

2 Answers2

2

FWIW, these days pycparser comes with PLY pre-packaged so it's no longer a pre-requisite. Just install pycparser and you're ready to go.

Eli Bendersky
  • 263,248
  • 89
  • 350
  • 412
  • Why not add `ply` to `install_requires`? (assuming that overriding `install` with `cmdclass` is a post-install action). Also, the generated tables are in the distribution archive on PyPI, so it seems that `setup.py` doesn't need to run PLY (like Cython is [recommended not to](http://docs.cython.org/src/reference/compilation.html#distributing-cython-modules) be called during installation). – 0 _ Mar 27 '15 at 10:08
1

Looks like it depends on ply. Download and install, and you should be fine.

codeape
  • 97,830
  • 24
  • 159
  • 188
  • Argh, can't believe they didn't put that in the readme (unless I missed it)... I'm not at my computer right now but I'll test it when I get the chance, thanks. +1 :) – user541686 Jun 06 '11 at 15:36
  • Looks like you missed it :) - http://code.google.com/p/pycparser/source/browse/README.txt#66 – codeape Jun 09 '11 at 11:30