Attribute Error for python module

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Attribute Error for python module

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 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.VERSION
AttributeError: '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
LinkedIn


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attribute Error for python module

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.VERSION
AttributeError: 'module' object has no attribute 'VERSION'

Please let me know where am I going wrong.

On Mon, May 22, 2017 at 12:40 PM Diptanshu Jamgade <[hidden email]> wrote:

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.VERSION
AttributeError: '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
LinkedIn

--
Diptanshu Jamgade

Fourth Year Undergraduate Student
Department of Electronics and Electrical Communication Engineering
IIT Kharagpur
(+91) 77-97-436-712
LinkedIn


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attribute Error for python module

Joshua Hawkinson
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.



On Tue, May 23, 2017 at 1:32 AM, Diptanshu Jamgade <[hidden email]> wrote:
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.VERSION
AttributeError: 'module' object has no attribute 'VERSION'

Please let me know where am I going wrong.

On Mon, May 22, 2017 at 12:40 PM Diptanshu Jamgade <[hidden email]> wrote:

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.VERSION
AttributeError: '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
LinkedIn

--
Diptanshu Jamgade

Fourth Year Undergraduate Student
Department of Electronics and Electrical Communication Engineering
IIT Kharagpur
(+91) 77-97-436-712
LinkedIn


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user




--
Regards,
Joshua Hawkinson
Manager of Software QA


2380 Bering Drive
San Jose, CA 95131


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Loading...