1. senex
  2. cppheaderparser
  3. Issues
Issue #12 resolved

Python3 installer error

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 setup.py egg_info for package CppHeaderParser

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

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

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

      File "/usr/local/lib/python3.3/dist-packages/CppHeaderParser/oldCppHeaderParser.py", 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 "main.py", line 11, in <module>
        from override import SIXMOZ_override
      File "modules/override.py", line 5, in <module>
        from parser import SIXMOZ_parser
      File "modules/parser.py", line 4, in <module>
        import CppHeaderParser
      File "/usr/local/lib/python3.3/dist-packages/CppHeaderParser/__init__.py", 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 CppHeaderClass.py:

    running install_lib
    copying build/lib/CppHeaderParser/doc/CppHeaderParser.html -> /usr/local/lib/python3.3/dist-packages/CppHeaderParser/doc
    copying build/lib/CppHeaderParser/examples/readSampleClass3.py -> /usr/local/lib/python3.3/dist-packages/CppHeaderParser/examples
    copying build/lib/CppHeaderParser/CppHeaderParser3.py -> /usr/local/lib/python3.3/dist-packages/CppHeaderParser
    byte-compiling /usr/local/lib/python3.3/dist-packages/CppHeaderParser/examples/readSampleClass3.py to readSampleClass3.cpython-33.pyc
    byte-compiling /usr/local/lib/python3.3/dist-packages/CppHeaderParser/CppHeaderParser3.py to CppHeaderParser3.cpython-33.pyc
    byte-compiling /usr/local/lib/python3.3/dist-packages/CppHeaderParser/CppHeaderParser.py to CppHeaderParser.cpython-33.pyc
      File "/usr/local/lib/python3.3/dist-packages/CppHeaderParser/CppHeaderParser.py", 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. 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 init.py 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.

  5. 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 ;)

  6. 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.

  7. Log in to comment