Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104030

Re: Any comment on using ctypesgen package?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Any comment on using ctypesgen package?
Date Fri, 04 Mar 2016 13:35:24 +0100
Organization None
Lines 53
Message-ID <mailman.186.1457094947.20602.python-list@python.org> (permalink)
References <3f342ec1-c6cd-49a8-aca2-2eac21fbbd79@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace news.uni-berlin.de kEVFGw9FA+4g9hX2qe7GcwNZuQKwrY669FQ4VnC5G+7g==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '-----------': 0.04; '"""': 0.05; '---------': 0.05; 'error:': 0.05; 'setup.py': 0.07; '2to3': 0.09; 'anymore.': 0.09; 'backwards': 0.09; 'object)': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'undefined.': 0.09; 'url:github': 0.09; 'python': 0.10; '"python': 0.16; '(before': 0.16; 'install"': 0.16; 'new-style': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:comment': 0.16; 'url:issues': 0.16; 'wrote:': 0.16; 'attribute': 0.18; 'first.': 0.18; 'try:': 0.18; 'portion': 0.20; 'fix': 0.21; '2.x': 0.22; 'pass': 0.22; 'defined': 0.23; 'seems': 0.23; 'written': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.26; 'question': 0.27; '2.0': 0.27; 'idea': 0.28; "skip:' 10": 0.28; 'skip:( 20': 0.28; '(it': 0.29; 'about.': 0.29; 'preserve': 0.29; 'types.': 0.29; 'raise': 0.29; 'classes': 0.30; 'comments': 0.30; 'code': 0.30; 'class.': 0.30; 'writes': 0.30; "i'd": 0.31; 'probably': 0.31; 'anyone': 0.32; 'skip:_ 10': 0.32; 'run': 0.33; 'class': 0.33; 'problem': 0.33; 'source': 0.33; 'utility': 0.33; 'open': 0.33; 'file': 0.34; 'except': 0.34; 'done': 0.35; 'instance': 0.35; 'mine': 0.35; 'skip:" 50': 0.35; 'knowledge': 0.35; 'comment': 0.35; 'but': 0.36; 'instead': 0.36; 'needed': 0.36; 'there': 0.36; 'possible': 0.36; 'depends': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'doing': 0.38; 'version': 0.38; 'anything': 0.38; 'someone': 0.38; 'test': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'received:de': 0.40; 'some': 0.40; 'your': 0.60; 'interest': 0.64; 'note:': 0.66; 'talking': 0.67; 'home': 0.67; 'miss': 0.77; '3.4': 0.84; 'object:': 0.84; 'route': 0.84; 'subject:Any': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host p57bd9e01.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:104030

Show key headers only | View raw


jfong@ms4.hinet.net wrote:

> I try to test this package but with no luck. This module was written for
> Python 2.x but mine is 3.4 so I use the 2To3 to "upgrade" it first (it
> seems OK). Then I run "python setup.py install" and get the following
> error:
>    ...
>    ...
>    File "D:\Patch\ctypesgen-master\ctypesgencore\parser\lex.py", line 41,
>    in <module>
>     _INSTANCETYPE = types.InstanceType
>    AttributeError: 'module' object has no attribute 'InstanceType'
> 
> Below is the troubled codes in file lex.py:
> Note: In original codes (before 2To3 modify), there is "types.ObjectType"
> instead of "object". ---------
> # Available instance types.  This is used when lexers are defined by a
> # class. It's a little funky because I want to preserve backwards
> # compatibility with Python 2.0 where types.ObjectType is undefined.
> try:
>     _INSTANCETYPE = (types.InstanceType, object)
> except AttributeError:
>     _INSTANCETYPE = types.InstanceType
>     class object: pass   # Note: needed if no new-style classes present
> -----------
> The author had put some comments above these codes but I have no idea what
> he is talking about.
> 
> There is someone who had encountered the same problem last year and raise
> a question at its home page, but the author seems has no interest on doing
> anything on it anymore.
> https://github.com/davidjamesca/ctypesgen/issues/53
> 
> Does anyone know how to fix it? or the whole job will be a mission
> impossible if no help from its author?

Nothing is impossible with open source ;)

What's possible for you depends on your knowledge and the amount of effort 
you are willing to spend. The page you link to has the comment

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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Any comment on using ctypesgen package? jfong@ms4.hinet.net - 2016-03-04 03:08 -0800
  Re: Any comment on using ctypesgen package? Chris Angelico <rosuav@gmail.com> - 2016-03-04 23:00 +1100
  Re: Any comment on using ctypesgen package? Peter Otten <__peter__@web.de> - 2016-03-04 13:35 +0100
    Re: Any comment on using ctypesgen package? jfong@ms4.hinet.net - 2016-03-04 21:35 -0800
      Re: Any comment on using ctypesgen package? Chris Angelico <rosuav@gmail.com> - 2016-03-05 16:49 +1100
        Re: Any comment on using ctypesgen package? jfong@ms4.hinet.net - 2016-03-05 00:14 -0800
          Re: Any comment on using ctypesgen package? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-05 11:59 +0000
            Re: Any comment on using ctypesgen package? jfong@ms4.hinet.net - 2016-03-06 16:57 -0800

csiph-web