Python3 installer error

Create issue
Issue #12 resolved
Sixdsn created an issue

When running pip3 install CppHeaderParser i have thoses errors

six@Boobies:~/$ sudo pip3 install CppHeaderParser
Downloading/unpacking CppHeaderParser
  Downloading CppHeaderParser-2.4.tar.gz (69kB): 69kB downloaded
  Running egg_info for package CppHeaderParser

Installing collected packages: CppHeaderParser
  Running install for CppHeaderParser
      File "/usr/local/lib/python3.3/dist-packages/CppHeaderParser/examples/", line 7
        except CppHeaderParser.CppParseError,  e:
    SyntaxError: invalid syntax

      File "/usr/local/lib/python3.3/dist-packages/CppHeaderParser/", line 587
        print rtn
    SyntaxError: invalid syntax

      File "/usr/local/lib/python3.3/dist-packages/CppHeaderParser/", line 7
        print f
    SyntaxError: invalid syntax

      File "/usr/local/lib/python3.3/dist-packages/CppHeaderParser/", line 136
        print "Lex error: ", v
    SyntaxError: invalid syntax

Successfully installed CppHeaderParser
Cleaning up...

Thoses are simple errors to support python3.

Comments (10)

  1. Sixdsn reporter

    Here is the traceback when trying to run the script with python3

    Traceback (most recent call last):
      File "", line 11, in <module>
        from override import SIXMOZ_override
      File "modules/", line 5, in <module>
        from parser import SIXMOZ_parser
      File "modules/", line 4, in <module>
        import CppHeaderParser
      File "/usr/local/lib/python3.3/dist-packages/CppHeaderParser/", line 7, in <module>
        from CppHeaderParser3 import *
    ImportError: No module named 'CppHeaderParser3'
  2. Sixdsn reporter


    i just checked it and it still doesn't build. i tried to fix it and did it for the build build, but during the installlation, it still tries to compile

    running install_lib
    copying build/lib/CppHeaderParser/doc/CppHeaderParser.html -> /usr/local/lib/python3.3/dist-packages/CppHeaderParser/doc
    copying build/lib/CppHeaderParser/examples/ -> /usr/local/lib/python3.3/dist-packages/CppHeaderParser/examples
    copying build/lib/CppHeaderParser/ -> /usr/local/lib/python3.3/dist-packages/CppHeaderParser
    byte-compiling /usr/local/lib/python3.3/dist-packages/CppHeaderParser/examples/ to readSampleClass3.cpython-33.pyc
    byte-compiling /usr/local/lib/python3.3/dist-packages/CppHeaderParser/ to CppHeaderParser3.cpython-33.pyc
    byte-compiling /usr/local/lib/python3.3/dist-packages/CppHeaderParser/ to CppHeaderParser.cpython-33.pyc
      File "/usr/local/lib/python3.3/dist-packages/CppHeaderParser/", line 587
        print rtn
    SyntaxError: invalid syntax

    To my point of view, it might be really easier to fix the litlle parts of code that aren't python3 compliant, it almost all about print and except. i will look at it

  3. senex repo owner

    You can ignore that. The package has both python 2 and python 3 code. It will complain when python 3 tries to compile the python 2 code, but you can ignore that. I will try to see if I can work around that later on. But after installing it functions properly with the latest.

  4. Sixdsn reporter

    Okay it works this way :) to me you shouldn't need to generate the python3 code, your code is almost compliant

  5. senex repo owner

    I am going to investigate cleaning up the output, but if you look at my makefile, I use 2to3 to generate the python 3 version of the file. The detects python 2 vs python 3 then does the right import appropriately. This is how I have 1 package that supports both. But pip3 makes things look broken when they arent. I will see if I can make it nicer.

  6. Sixdsn reporter

    yep but the code that needs to be modified (as outputed bu 2to3) shouldn't break retro compatibility so i guess you don't need to use 2to3 if your python2 code respects the python3 behaviour. but it's your work do it the way you want :) and thanks again for the support ;)

  7. senex repo owner

    I looked at both and yes, you are right. The python3 version runs on python2 just fine, so I made this adjustment in the latest commit.

  8. Log in to comment