AttributeError: 'NoneType' object has no attribute '_handle' using python3.7
leond08 opened this issue · comments
I'm using python3.7and iptc version 0.13.0 when i try to import iptc i got an error:
File "<stdin>", line 1, in <module>
FIle "/usr/lib/python3.7/site-packages/iptc/__init__.py", line 10, in <module>
from iptc.ip4tc import (is_table_available, Table, Chain, Rule, Match, Target, Policy, IPTCError)
File "/usr/lib/python3.7/site-packages/iptc/ip4tc.py", line 13, in <module>
from .xtables import (XT_INV_PROTO, NFPROTO_IPV4, XTablesError, xtables,
FIle "/usr/lib/python3.7/site-packages/iptc/xtables.py", line 796, in <module>
_optind = ct.c_long.in_dll(_libc, "optind")
AttributeError: 'NoneType' object has no attribute '_handle'
is this python version error?
any work around for this :)
Any idea on this?
By the way i am currently using Buildroot for my raspberry pi 3B+
NAME=Buildroot
VERSION=2019.02.1-g48c5339-dirty
ID=buildroot
VERSION_ID=2019.02.1
PRETTY_NAME="Buildroot 2019.02.1"
Kernel Version 4.14
I have libiptc.so and libxtables.so in /usr/lib
I will try to compile the source from master as @frankvanbever has the latest commit
hope this would solve my problem.
For the 0.14 release I've got the following patch series submitted to Buildroot upstream that should solve all find_library() issues. If you were to test it and it works for you could you please mark it as Tested-by?
@frankvanbever after applying the patch
I got this error
Python 3.7.2 (default, Mar 6 2020, 01:18:18)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import iptc
/usr/bin/python3.7: '/usr/lib/python3.7/site-packages/iptc' is not an ELF file
/usr/bin/python3.7: '/usr/lib/python3.7/site-packages/iptc' is not an ELF file
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/iptc/__init__.py", line 10, in <module>
from iptc.ip4tc import (is_table_available, Table, Chain, Rule, Match, Target, Policy, IPTCError)
File "/usr/lib/python3.7/site-packages/iptc/ip4tc.py", line 113, in <module>
class iptc(object):
File "/usr/lib/python3.7/site-packages/iptc/ip4tc.py", line 115, in iptc
iptc_init = _libiptc.iptc_init
AttributeError: 'NoneType' object has no attribute 'iptc_init'
any idea? how to solve this issue.
Hi @leond08 I was able to reproduce the issue. ⬆️ the PR I submitted fixes the issue for me.
@frankvanbever i will test this on my end. Thanks!
Yeah It works now on my environment!
Thanks @frankvanbever
@leond08 Great to hear that it works for you. If you have a couple of minutes to spare, could you please mark the patch as Tested-by:
?
The procedure is explained here: http://nightly.buildroot.org/manual.html#_reviewing_and_testing_patches
If you're not subscribed to the mailing list I can add it for you, I just need a name, e-mail address and a short description of the test you did. If you're uncomfortable sharing this here you can send it to me via e-mail at frank.vanbever@essensium.com
This might help with getting this fix merged in Buildroot sooner.
It seems this has been fixed, so closing this issue.