andrewhwood / alembic

Automatically exported from code.google.com/p/alembic
Other
0 stars 0 forks source link

Python AttributeError when importing alembic #335

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. import alembic

What is the expected output? What do you see instead?
Expected it to work ;) But we get

In [1]: import alembic
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-047a7ddc947b> in <module>()
----> 1 import alembic

AttributeError: 'NoneType' object has no attribute 'BaseExc'

We notice that if we import imath after this exception, then import alembic 
again, it seems to work fine. But it has to be in that exact order!

What version of the product are you using? On what operating system?

Tested with Alembic 1.5.2 and 1.5.3 on CentOS 6.4 with Python 2.6.5, GCC 4.1.2, 
Boost 1.46.1, IlmBase 2.1.0, PyIlmBase 2.1.0, OpenEXR 2.1.0, HDF5 1.8.12.

Please provide any additional information below.

Original issue reported on code.google.com by aj.d...@gmail.com on 4 Mar 2014 at 11:50

GoogleCodeExporter commented 9 years ago
So it sounds like alembic needs to do an import imath internally (or wrapped in 
an __init__.py before loading the .so)

Original comment by miller.lucas on 4 Mar 2014 at 7:15

GoogleCodeExporter commented 9 years ago

Original comment by miller.lucas on 4 Mar 2014 at 7:16

GoogleCodeExporter commented 9 years ago
I was able to get this to work by changing the link order when building 
PyAlembic.  Modify CMakeLists.txt in PyAlembic to be this order:

LINK_LIBRARIES( ${CORE_LIBS}
                  ${ALEMBIC_HDF5_LIBS}
                  ${ALEMBIC_PYILMBASE_PYIMATH_LIB}
                  ${PLIBS}
                  ${ZLIB_LIBRARIES}
                  ${EXTERNAL_MATH_LIBS} 
                  ${ALEMBIC_ILMBASE_LIBS})

Original comment by rjmerc...@gmail.com on 12 Mar 2014 at 2:55

GoogleCodeExporter commented 9 years ago
What are people at other sites doing differently such that this works out of 
the box?

Original comment by aj.d...@gmail.com on 14 May 2014 at 11:25

GoogleCodeExporter commented 9 years ago
They are importing imath first.

In all of the examples and tests included in Alembic, import imath happens 
before import alembic.

Original comment by miller.lucas on 14 May 2014 at 4:47