PyTox icon indicating copy to clipboard operation
PyTox copied to clipboard

ImportError: cannot import name ToxAV

Open ymkim92 opened this issue 10 years ago • 9 comments

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

ymkim92 avatar Dec 24 '14 06:12 ymkim92

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

aitjcize avatar Dec 25 '14 13:12 aitjcize

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

ymkim92 avatar Dec 26 '14 05:12 ymkim92

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

aitjcize avatar Dec 27 '14 09:12 aitjcize

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

ymkim92 avatar Dec 27 '14 23:12 ymkim92

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

aitjcize avatar Jan 18 '15 07:01 aitjcize

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
$

ymkim92 avatar Jan 21 '15 20:01 ymkim92

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

aitjcize avatar Jan 22 '15 13:01 aitjcize

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!

ymkim92 avatar Jan 22 '15 21:01 ymkim92

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

mrshu avatar Sep 27 '15 15:09 mrshu