PyTox
PyTox copied to clipboard
ImportError: cannot import name ToxAV
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
You must compile toxcore with av support. You can check this by check if there is libtoxav.so under /usr/lib.
I have libtoxav.so in /usr/local/lib
. How can I use this library?
Thank you.
Can you rebuild the pytox module and try it again?
Also please show me the result of ldconfig -p | grep toxav
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
Sorry I've been busy. Can you show me the output of python setup.py build
?
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
$
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
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 if you are still interested you can try the current master, it uses the new tox API.