Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

ImportError: cannot import name ToxAV #38

Open
ymkim92 opened this issue Dec 24, 2014 · 9 comments
Open

ImportError: cannot import name ToxAV #38

ymkim92 opened this issue Dec 24, 2014 · 9 comments

Comments

@ymkim92
Copy link

ymkim92 commented Dec 24, 2014

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
Copy link
Owner

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

@ymkim92
Copy link
Author

ymkim92 commented Dec 26, 2014

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

@aitjcize
Copy link
Owner

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

@ymkim92
Copy link
Author

ymkim92 commented Dec 27, 2014

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
Copy link
Owner

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

@ymkim92
Copy link
Author

ymkim92 commented Jan 21, 2015

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
Copy link
Owner

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
Copy link
Author

ymkim92 commented Jan 22, 2015

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
Copy link
Contributor

mrshu commented Sep 27, 2015

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants