Python import error for PyInit_wpaspy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm attempting to cross compile wpaspy with Buildroot and when I
attempt to import it on the system I compiled it for, I get the
following error

# python3
Python 3.8.1 (default, Mar 30 2020, 09:50:30)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wpaspy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define module export function ()

>From initial searches on the internet, I thought I was possibly
accidentally using python 2 instead of python 3 during the compile
step which would cause the error. However, I looked at my build output
and added a python version print to the setup.py and both checked out.

Part of the build output showing that python 3.8.1 is used to build

PYTHONPATH="/accts/jmbents/rclinux/target_build/apm86290_common_platform_debug_defconfig/target/usr/lib/python3.8/"
PYTHONNOUSERSITE=1
_PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata__linux_powerpc-linux-gnu"
_python_sysroot=/accts/jmbents/rclinux/target_build/apm86290_common_platform_debug_defconfig/host/powerpc-buildroot-linux-gnu/sysroot
_python_prefix=/usr _python_exec_prefix=/usr
/accts/jmbents/rclinux/target_build/apm86290_common_platform_debug_defconfig/host/bin/python
setup.py build --executable=/usr/bin/python )
Python version3.8.1 (default, Mar 30 2020, 09:47:30).
[GCC 7.4.0]
running build
running build_ext

Below is my verification of the symlinks provided by Buildroot

jmbents@gravy:~/rclinux/target_build/apm86290_common_platform_debug_defconfig$
ls -l /accts/jmbents/rclinux/target_build/apm86290_common_platform_debug_defconfig/host/bin/python
lrwxrwxrwx 1 jmbents genusers 7 Mar 30 09:47
/accts/jmbents/rclinux/target_build/apm86290_common_platform_debug_defconfig/host/bin/python
-> python3
jmbents@gravy:~/rclinux/target_build/apm86290_common_platform_debug_defconfig$
ls -l /accts/jmbents/rclinux/target_build/apm86290_common_platform_debug_defconfig/host/bin/python3
lrwxrwxrwx 1 jmbents genusers 9 Mar 30 09:47
/accts/jmbents/rclinux/target_build/apm86290_common_platform_debug_defconfig/host/bin/python3
-> python3.8

Has anyone had success cross compiling wpaspy with python 3 support? I
had run into a couple prior problems when using python 3 but sorted
those out and once I get everything working, I plan on upstreaming
them. I've included the diffs below for reference.

diff --git a/wpaspy/wpaspy.c b/wpaspy/wpaspy.c
index 278089b48..8a7c1fe1a 100644
--- a/wpaspy/wpaspy.c
+++ b/wpaspy/wpaspy.c
@@ -44,8 +44,8 @@ static void wpaspy_close(struct wpaspy_obj *self)
 >......>.......self->ctrl = NULL;
 >......}
.
->......if (self->ob_type)
->......>.......self->ob_type->tp_free((PyObject *) self);
+>......if (Py_TYPE(self))
+>......>.......Py_TYPE(self)->tp_free((PyObject *) self);
 }
.
.
@@ -198,12 +198,22 @@ static PyMethodDef module_methods[] = {
 };
.
.
+static struct PyModuleDef wpaspy =
+{
+    PyModuleDef_HEAD_INIT,
+    "wpaspy",
+    "",
+    -1,
+    module_methods
+};
+
+
 PyMODINIT_FUNC initwpaspy(void)
 {
 >......PyObject *mod;
.
 >......PyType_Ready(&wpaspy_ctrl);
->......mod = Py_InitModule("wpaspy", module_methods);
+>......mod = PyModule_Create(&wpaspy);
 >......wpaspy_error = PyErr_NewException("wpaspy.error", NULL, NULL);
.
 >......Py_INCREF(&wpaspy_ctrl);

Thank you,
Jared

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux