ethanhs / clang

Unofficial Python bindings to libclang
Other
27 stars 6 forks source link

python 2 incompatible? #1

Closed paleozogt closed 6 years ago

paleozogt commented 6 years ago

I cannot install clang with python2:

C:\Users\vagrant>pip2 install clang
Collecting clang
  Using cached https://files.pythonhosted.org/packages/b2/2a/5ab52ae9d9e7684b66062e953a0cbdf326a35657aaf59cd31a09b7b86504/clang-6.0.0.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\vagrant\appdata\local\temp\pip-install-mb4pkb\clang\setup.py", line 6, in <module>
        with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
    TypeError: 'encoding' is an invalid keyword argument for this function

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\vagrant\appdata\local\temp\pip-install-mb4pkb\clang\

C:\Users\vagrant>pip3 install clang
Collecting clang
  Using cached https://files.pythonhosted.org/packages/a3/7a/be6f10a6e835095cfafb4cee3f5fce6b0851f97e8a965185691465f137b7/clang-6.0.0.1-py3-none-any.whl
Installing collected packages: clang
Successfully installed clang-6.0.0.1
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\vagrant>
ethanhs commented 6 years ago

Ah, Python 2's open doesn't have an encoding keyword argument. I'll put in a fix later and make a release. In the mean time, you can try the following:

git clone https://github.com/ethanhs/clang
cd clang
(add "from io import open" to the top of setup.py)
pip2 install .

I'll add some more CI tests to make sure things work under python 2.

ethanhs commented 6 years ago

Okay, this is fixed in 6.0.0.2 which is now on PyPi. Let me know if you have any issues!

paleozogt commented 6 years ago

Works for me. Thanks!

ethanhs commented 6 years ago

Great! You're welcome