Any comment on using ctypesgen package?

jfong at ms4.hinet.net jfong at ms4.hinet.net
Sat Mar 5 00:35:13 EST 2016


Peter Otten 2016/3/4  UTC+8 8:36:02PM worte:
> """
> The 2to3 route is not likely to apply since ctypesgen actually writes Python 
> code and the 2to3 utility will probably miss a good portion of that logic.
> """
> 
> But as someone else seems to have done the work already
> 
> https://github.com/davidjamesca/ctypesgen/issues/51
> 
> I'd try his version first.

Following this link, it says "Make output python3-compatible". So it still run under 2.x but generate codes for 3.x:-(

After taking Chris's suggestion, the installation is pushing forward a little and then bump into another error:
----------
File "D:\Patch\ctypesgen-master\ctypesgencore\parser\pplexer.py", line 123, in  
punctuator_regex
    punctuator_regexes.sort(lambda a, b: -cmp(len(a), len(b)))
TypeError: must use keyword argument for key function
----------
This error has been mentioned in "Sorting HOW TO" section in 3.4 document,
    "In Py3.0, the cmp parameter was removed entirely"
    "To convert to a key function, just wrap the old comparison function:"
    "In Python 3.2, the functools.cmp_to_key() function was added to the functools module in the standard library."

Oh, goodness! do I have to dive into 2.x?

Based on the assumptions below:
1. It might be not easy to upgrade it to 3.x (at least not just run 2To3), or else its author will not drop it.
2. I have to go back into 2.x jungle to study all these difference.
3. Even "Python setup.py install" passed, it's still not sure if the output will be correct.

I think it's better to drop it too. Thanks for your advice, Chris and Peter.

--Jach




More information about the Python-list mailing list