Discussion:
[Swig-user] Attribute Error for python module
Diptanshu Jamgade
2017-05-22 07:10:23 UTC
Permalink
Hello,
My name is Diptanshu. I am presently working with CCExtractor on a project
of developing python extension module and I am enrolled in GSOC 2017.
For generating the python modules, I tried to take up SWIG but I am
presently having trouble. You can find my interface file at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_bento_16_library/linux/ccextractorapi.i
. The corresponding C code is available at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_bento_16_library/src/ccextractorapi.c
and the respective header file at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_bento_16_library/src/ccextractorapi.h
. Now the generated wrapper code has been generated using the command `swig
-python ccextractorapi.i` and the wrapper could be found at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_bento_16_library/linux/ccextractorapi_wrap.c
. Now when I am generating a .so file with this and trying to import the
module in python 2.7, I am getting the following error:





*Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "ccextractorapi.py", line 98, in <module> VERSION =
_ccextractorapi.VERSIONAttributeError: 'module' object has no attribute
'VERSION'*
Tracing back to the ccextractorapi.py file, I am unable to understand how I
am getting this attribute error as this attribute doesn't exist in entire
codebase. Kindly let me know about how to get rid of this error.
I am presently working on Ubuntu 16.04 LTS vagrant box.
Thank you.
--
*​Diptanshu Jamgade *
Fourth Year Undergraduate Student
Department of Electronics and Electrical Communication Engineering
IIT Kharagpur
(+91) 77-97-436-712
<https://mail.google.com/mail/u/0/goog_1543320810>
Email <***@gmail.com>
LinkedIn <https://in.linkedin.com/in/diptanshu-jamgade>
Diptanshu Jamgade
2017-05-23 08:32:25 UTC
Permalink
Hello,
It seems that I have a line called #define VERSION "0.85" in my codebase
and the corresponding header file is also included in the SWIG interface
file. But still I am getting




*Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "ccextractorapi.py", line 98, in <module> VERSION =
_ccextractorapi.VERSIONAttributeError: 'module' object has no attribute
'VERSION'*
Please let me know where am I going wrong.
Post by Diptanshu Jamgade
Hello,
My name is Diptanshu. I am presently working with CCExtractor on a project
of developing python extension module and I am enrolled in GSOC 2017.
For generating the python modules, I tried to take up SWIG but I am
presently having trouble. You can find my interface file at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_bento_16_library/linux/ccextractorapi.i
. The corresponding C code is available at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_bento_16_library/src/ccextractorapi.c
and the respective header file at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_bento_16_library/src/ccextractorapi.h
. Now the generated wrapper code has been generated using the command `swig
-python ccextractorapi.i` and the wrapper could be found at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_bento_16_library/linux/ccextractorapi_wrap.c
. Now when I am generating a .so file with this and trying to import the
*Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "ccextractorapi.py", line 98, in <module> VERSION =
_ccextractorapi.VERSIONAttributeError: 'module' object has no attribute
'VERSION'*
Tracing back to the ccextractorapi.py file, I am unable to understand how
I am getting this attribute error as this attribute doesn't exist in entire
codebase. Kindly let me know about how to get rid of this error.
I am presently working on Ubuntu 16.04 LTS vagrant box.
Thank you.
--
*​Diptanshu Jamgade *
Fourth Year Undergraduate Student
Department of Electronics and Electrical Communication Engineering
IIT Kharagpur
(+91) 77-97-436-712
<https://mail.google.com/mail/u/0/goog_1543320810>
LinkedIn <https://in.linkedin.com/in/diptanshu-jamgade>
--
*​Diptanshu Jamgade *
Fourth Year Undergraduate Student
Department of Electronics and Electrical Communication Engineering
IIT Kharagpur
(+91) 77-97-436-712
<https://mail.google.com/mail/u/0/goog_1543320810>
Email <***@gmail.com>
LinkedIn <https://in.linkedin.com/in/diptanshu-jamgade>
Joshua Hawkinson
2017-05-23 16:42:05 UTC
Permalink
Hey there,

I'm guessing it's a linking issue?

Try "ldd <name of .so file>" to verify that you have all of the appropriate
libraries linked. Also, try "nm <name of .so file>" and look for undefined
symbols. I'm hoping this gives you some insight into what sources are
missing.
Post by Diptanshu Jamgade
Hello,
It seems that I have a line called #define VERSION "0.85" in my codebase
and the corresponding header file is also included in the SWIG interface
file. But still I am getting
*Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "ccextractorapi.py", line 98, in <module> VERSION =
_ccextractorapi.VERSIONAttributeError: 'module' object has no attribute
'VERSION'*
Please let me know where am I going wrong.
Post by Diptanshu Jamgade
Hello,
My name is Diptanshu. I am presently working with CCExtractor on a
project of developing python extension module and I am enrolled in GSOC
2017.
For generating the python modules, I tried to take up SWIG but I am
presently having trouble. You can find my interface file at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_
bento_16_library/linux/ccextractorapi.i . The corresponding C code is
available at https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_
bento_16_library/src/ccextractorapi.c and the respective header file at
https://github.com/Diptanshu8/ccextractor/blob/gsoc_work_
bento_16_library/src/ccextractorapi.h . Now the generated wrapper code
has been generated using the command `swig -python ccextractorapi.i` and
the wrapper could be found at https://github.com/Diptanshu8/
ccextractor/blob/gsoc_work_bento_16_library/linux/ccextractorapi_wrap.c
. Now when I am generating a .so file with this and trying to import the
*Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "ccextractorapi.py", line 98, in <module> VERSION =
_ccextractorapi.VERSIONAttributeError: 'module' object has no attribute
'VERSION'*
Tracing back to the ccextractorapi.py file, I am unable to understand how
I am getting this attribute error as this attribute doesn't exist in entire
codebase. Kindly let me know about how to get rid of this error.
I am presently working on Ubuntu 16.04 LTS vagrant box.
Thank you.
--
*​Diptanshu Jamgade *
Fourth Year Undergraduate Student
Department of Electronics and Electrical Communication Engineering
IIT Kharagpur
(+91) 77-97-436-712
<https://mail.google.com/mail/u/0/goog_1543320810>
LinkedIn <https://in.linkedin.com/in/diptanshu-jamgade>
--
*​Diptanshu Jamgade *
Fourth Year Undergraduate Student
Department of Electronics and Electrical Communication Engineering
IIT Kharagpur
(+91) 77-97-436-712
<https://mail.google.com/mail/u/0/goog_1543320810>
LinkedIn <https://in.linkedin.com/in/diptanshu-jamgade>
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
https://lists.sourceforge.net/lists/listinfo/swig-user
--
Regards,
Joshua Hawkinson
Manager of Software QA


2380 Bering Drive
San Jose, CA 95131
Continue reading on narkive:
Loading...