HI Andi, Please see below print out
-declares : {<Class: interface it.unimi.dsi.fastutil.h>, <Class: class java.lang.Class>, <Class: interface it.unimi.dsi.fastutil.c>, <Class: interface it.unimi.dsi.fastutil.h.au>, <Class: interface it.unimi.dsi.fastutil.h.H>} --declareNames : ['it', 'unimi', 'dsi', 'fastutil', 'h'] ---declareName : it ---namespace : {} ---declareName : unimi ---namespace : {} ---declareName : dsi ---namespace : {} ---declareName : fastutil ---namespace : {} --declareNames : ['java', 'lang', 'Class'] ---declareName : java ---namespace : {'it': {'unimi': {'dsi': {'fastutil': {'h': True}}}}} ---declareName : lang ---namespace : {} --declareNames : ['it', 'unimi', 'dsi', 'fastutil', 'h', 'au'] ---declareName : it ---namespace : {'it': {'unimi': {'dsi': {'fastutil': {'h': True}}}}, 'java': {'lang': {'Class': True}}} ---declareName : unimi ---namespace : {'unimi': {'dsi': {'fastutil': {'h': True}}}} ---declareName : dsi ---namespace : {'dsi': {'fastutil': {'h': True}}} ---declareName : fastutil ---namespace : {'fastutil': {'h': True}} ---declareName : h ---namespace : {'h': True} Above is one of many classes that hit with the 'bool' object has no attribute 'setdefault'. Another one -declares : {<Class: class java.lang.Class>, <Class: interface swapclear.com.lchclearnet.c.a.a.a.a>, <Class: interface swapclear.com.lchclearnet.c.a.b.a.a>, <Class: interface swapclear.com.lchclearnet.c.a.b.a.a.a.a.a.a>, <Class: class swapclear.com.lchclearnet.c.a.b.a.e>, <Class: interface swapclear.com.lchclearnet.c.a.c.a>} --declareNames : ['java', 'lang', 'Class'] ---declareName : java ---namespace : {} ---declareName : lang ---namespace : {} --declareNames : ['swapclear', 'com', 'lchclearnet', 'c', 'a', 'a', 'a', 'a'] ---declareName : swapclear ---namespace : {'java': {'lang': {'Class': True}}} ---declareName : com ---namespace : {} ---declareName : lchclearnet ---namespace : {} ---declareName : c ---namespace : {} ---declareName : a ---namespace : {} ---declareName : a ---namespace : {} ---declareName : a ---namespace : {} --declareNames : ['swapclear', 'com', 'lchclearnet', 'c', 'a', 'b', 'a', 'a'] ---declareName : swapclear ---namespace : {'java': {'lang': {'Class': True}}, 'swapclear': {'com': {'lchclearnet': {'c': {'a': {'a': {'a': {'a': True}}}}}}}} ---declareName : com ---namespace : {'com': {'lchclearnet': {'c': {'a': {'a': {'a': {'a': True}}}}}}} ---declareName : lchclearnet ---namespace : {'lchclearnet': {'c': {'a': {'a': {'a': {'a': True}}}}}} ---declareName : c ---namespace : {'c': {'a': {'a': {'a': {'a': True}}}}} ---declareName : a ---namespace : {'a': {'a': {'a': {'a': True}}}} ---declareName : b ---namespace : {'a': {'a': {'a': True}}} ---declareName : a ---namespace : {} --declareNames : ['swapclear', 'com', 'lchclearnet', 'c', 'a', 'b', 'a', 'a', 'a', 'a', 'a', 'a'] ---declareName : swapclear ---namespace : {'java': {'lang': {'Class': True}}, 'swapclear': {'com': {'lchclearnet': {'c': {'a': {'a': {'a': {'a': True}}, 'b': {'a': {'a': True}}}}}}}} ---declareName : com ---namespace : {'com': {'lchclearnet': {'c': {'a': {'a': {'a': {'a': True}}, 'b': {'a': {'a': True}}}}}}} ---declareName : lchclearnet ---namespace : {'lchclearnet': {'c': {'a': {'a': {'a': {'a': True}}, 'b': {'a': {'a': True}}}}}} ---declareName : c ---namespace : {'c': {'a': {'a': {'a': {'a': True}}, 'b': {'a': {'a': True}}}}} ---declareName : a ---namespace : {'a': {'a': {'a': {'a': True}}, 'b': {'a': {'a': True}}}} ---declareName : b ---namespace : {'a': {'a': {'a': True}}, 'b': {'a': {'a': True}}} ---declareName : a ---namespace : {'a': {'a': True}} ---declareName : a ---namespace : {'a': True} ---declareName : a ---namespace : True So I'm not sure how many classes in the jar that causing this issue. There is a similar code in python.py line 1547 Thanks, Chee Yong Chee Yong Teh 27 Bush Lane, London, EC4R 0AN | +44 203 929 3138 OTC Infrastructure Service of the Year & Global Compression Service of the Year -----Original Message----- From: Andi Vajda <va...@apache.org> Sent: 05 May 2020 17:50 To: pylucene-dev@lucene.apache.org Subject: Re: AttributeError: 'bool' object has no attribute 'setdefault' On Mon, 4 May 2020, Chee Yong Teh wrote: > I'm in the processing of testing JCC to wrap third party library jar. > > When I run JCC 3.7 I got the following error > > Traceback (most recent call last): > File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main > "__main__", mod_spec) > File "/usr/lib/python3.6/runpy.py", line 85, in _run_code > exec(code, run_globals) > File > "/home/cheeyong.teh/venv/simm/lib/python3.6/site-packages/jcc/__main__.py", > line 107, in <module> > cpp.jcc(sys.argv) > File "/home/cheeyong.teh/venv/simm/lib/python3.6/site-packages/jcc/cpp.py", > line 711, in jcc > _dll_export) > File "/home/cheeyong.teh/venv/simm/lib/python3.6/site-packages/jcc/cpp.py", > line 937, in header > namespace = namespace.setdefault(declareName, {}) > AttributeError: 'bool' object has no attribute 'setdefault' > > This line "namespace = namespace.setdefault(declareName, {})" assume > namespace.setdefault(declareName, {}) will return {} but somehow it > returns True. So namespace has True value and it errors in next > iteration in the loop. Not sure it's a bug or the jar is too > complicated to parse/convert due to a directory/structure. I can send > over the library if you need to debug/reproduce the error on your > machine Could you please put a conditional breakpoint before the line where this error happens and tell me what 'declares' is set to ? Thanks ! Andi.. > > The commandline I use > > python -m jcc \ > --use_full_names \ > --no-generics \ > --jar lib/smart-swapclear-public-release_daru.12.jar \ --include > lib/colt-1.2.0.jar \ --include lib/commons-math3-3.6.1.jar \ --include > lib/jna-5.2.0.jar \ --include lib/log4j-1.2.16.jar \ --include > lib/protobuf-java-3.5.1.jar \ --include lib/slf4j-api-1.6.1.jar \ > --include lib/slf4j-log4j12-1.6.1.jar \ --python lch_smart --build > -install > > Another question, --jar option seem to wrap all the public classes found > inside the jar. Is there an option that only wrap certain public classes > under package com.lchclearnet.* inside a jar? There is an option called > exclude for classes but it will be nightmare to workout all the classes I > don't want to wrap inside the jar. > > Thanks, > > Kinds regards, > > Chee Yong > > Chee Yong Teh > 27 Bush Lane, London, EC4R 0AN | +44 203 929 3138 OTC Infrastructure > Service of the Year & Global Compression Service of the Year > > Disclaimer > > The information contained in this communication from the sender is > confidential. It is intended solely for use by the recipient and others > authorized to receive it. If you are not the recipient, you are hereby > notified that any disclosure, copying, distribution or taking action in > relation of the contents of this information is strictly prohibited and may > be unlawful. > > This email has been scanned for viruses and malware, and may have been > automatically archived by Mimecast Ltd, an innovator in Software as a Service > (SaaS) for business. Providing a safer and more useful place for your human > generated data. Specializing in; Security, archiving and compliance. To find > out more visit the Mimecast website. > Disclaimer The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful. This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business. Providing a safer and more useful place for your human generated data. Specializing in; Security, archiving and compliance. To find out more visit the Mimecast website.