aitjcize / PyTox

Python binding for Project-Tox the skype replacement.
GNU General Public License v3.0
96 stars 29 forks source link

ImportError: cannot import name ToxAV #38

Open ymkim92 opened 9 years ago

ymkim92 commented 9 years ago

Hello,

I installed PyTox on both my ubuntu trusty and docker, but both have the same problem. When I run python example/echo.py, I meet this error:

root@db3d34e64d04:/PyTox# python examples/echo.py 
Traceback (most recent call last):
  File "examples/echo.py", line 26, in <module>
    from pytox import Tox, ToxAV
ImportError: cannot import name ToxAV

Can you help me?

Regards, Kim

aitjcize commented 9 years ago

You must compile toxcore with av support. You can check this by check if there is libtoxav.so under /usr/lib.

ymkim92 commented 9 years ago

I have libtoxav.so in /usr/local/lib. How can I use this library? Thank you.

aitjcize commented 9 years ago

Can you rebuild the pytox module and try it again? Also please show me the result of ldconfig -p | grep toxav

ymkim92 commented 9 years ago

I did python setup.py clean and python setup.py install, but there is still the same problem.

This is the result of ldconfig:

$ ldconfig -p | grep toxav
    libtoxav.so.0 (libc6,x86-64) => /usr/local/lib/libtoxav.so.0
    libtoxav.so (libc6,x86-64) => /usr/local/lib/libtoxav.so
aitjcize commented 9 years ago

Sorry I've been busy. Can you show me the output of python setup.py build?

ymkim92 commented 9 years ago

Hi aitjcize,

This is the output

$ python setup.py build
running build
running build_ext
building 'pytox' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/pytox
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c pytox/pytox.c -o build/temp.linux-x86_64-2.7/pytox/pytox.o -Wall -Wno-declaration-after-statement -DENABLE_AV
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c pytox/core.c -o build/temp.linux-x86_64-2.7/pytox/core.o -Wall -Wno-declaration-after-statement -DENABLE_AV
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c pytox/util.c -o build/temp.linux-x86_64-2.7/pytox/util.o -Wall -Wno-declaration-after-statement -DENABLE_AV
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c pytox/av.c -o build/temp.linux-x86_64-2.7/pytox/av.o -Wall -Wno-declaration-after-statement -DENABLE_AV
creating build/lib.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/pytox/pytox.o build/temp.linux-x86_64-2.7/pytox/core.o build/temp.linux-x86_64-2.7/pytox/util.o build/temp.linux-x86_64-2.7/pytox/av.o -ltoxcore -ltoxav -o build/lib.linux-x86_64-2.7/pytox.so
$
aitjcize commented 9 years ago

From the output the AV module is built. So you should able to import ToxAV. Can you try importing again? To make sure you are importing the correct module, please cd build/lib.linux-x86_64-2.7 then from pytox import Tox, ToxAV

ymkim92 commented 9 years ago

It is working!

PyTox/build/lib.linux-x86_64-2.7$ python -c 'from pytox import Tox, ToxAV'
PyTox/build/lib.linux-x86_64-2.7$

But in examples folder:

PyTox/examples$ python -c 'from pytox import Tox, ToxAV'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: cannot import name ToxAV

What can I do next? Thanks a lot!

mrshu commented 8 years ago

@ymkim92 if you are still interested you can try the current master, it uses the new tox API.