I believe I have this working on Python 3.5 (on OSX)
pip3 install cython
./build_world.sh
python3 setup.py develop
export LD_LIBRARY_PATH=/Users/pi/Dev/pythonStuff/VowelGen/world.py/tests
I'm pretty sure that last line is unnecessary, because LD_LIBRARY_PATH did not exist. I think that is a Windows thing.
cd /Users/pi/Dev/pythonStuff/VowelGen/world.py/tests
python3 test_world.py
The last line gives:
[email protected] ~ /Users/pi/Dev/pythonStuff/VowelGen/world.py/tests:
⤐ python3 test_world.py
Traceback (most recent call last):
File "test_world.py", line 4, in <module>
from world import *
ImportError: dlopen(/Users/pi/Dev/pythonStuff/VowelGen/world.py/world.cpython-35m-darwin.so, 2): Library not loaded: /usr/local/lib/libworld.dylib
Referenced from: /Users/pi/Dev/pythonStuff/VowelGen/world.py/world.cpython-35m-darwin.so
Reason: image not found
Searching my filesystem locates /Users/pi/Dev/pythonStuff/VowelGen/world.py/lib/world/build/src/libworld.dylib
And setup.py
has:
library_dirs = [os.path.join(os.getcwd(), 'lib/world/build/src/')],
So I cannot see why it does not find it. Anyway, manually copy this libworld.dylib
into my /usr/local/lib/
fixes it.
If I ls -l
,
[email protected] ~ /Users/pi/Dev/pythonStuff/VowelGen/world.py:
⤐ ls -l
total 2880
-rw-r--r-- 1 pi staff 534 28 Oct 21:59 README.md
drwxr-xr-x 3 pi staff 102 28 Oct 22:01 build
-rwxr-xr-x 1 pi staff 103 28 Oct 21:59 build_world.sh
drwxr-xr-x 3 pi staff 102 28 Oct 21:59 lib
lrwxr-xr-x 1 pi staff 31 28 Oct 21:59 libworld.so -> lib/world/build/src/libworld.so
lrwxr-xr-x 1 pi staff 33 28 Oct 21:59 libworld.so.0 -> lib/world/build/src/libworld.so.0
lrwxr-xr-x 1 pi staff 37 28 Oct 21:59 libworld.so.0.1.4 -> lib/world/build/src/libworld.so.0.1.4
drwxr-xr-x 18 pi staff 612 28 Oct 21:59 scripts
-rw-r--r-- 1 pi staff 554 28 Oct 21:59 setup.py
drwxr-xr-x 4 pi staff 136 28 Oct 21:59 tests
-rw-r--r-- 1 pi staff 1150244 28 Oct 22:01 world.cpp
-rwxr-xr-x 1 pi staff 280808 28 Oct 22:01 world.cpython-35m-darwin.so
drwxr-xr-x 6 pi staff 204 28 Oct 22:01 world.egg-info
-rw-r--r-- 1 pi staff 2206 28 Oct 21:59 world.pxd
-rw-r--r-- 1 pi staff 8660 28 Oct 21:59 world.pyx
...it looks as though world.cpython-35m-darwin.so
is failing to see libworld.so
because it is looking for libworld.dylib
-- or maybe there should be an additional libworld.dylib -> lib/world/build/src/libworld.dylib
symlink?
ok, now python3 test_world.py
completes but it doesn't do anything. Looking at the source code for test_world.py
it is clear why. It just creates a class. Shouldn't this file also test the class it creates? Otherwise it doesn't seem to make any sense. What is this file doing? What is this folder doing?
It's misleading because it is in /tests
and the actual test.py
is in /scripts
. So when I read the readme.md, I assumed there was some typing error. I did not think to look in /scripts
I needed to modify /scripts/test.py
in three places:
file = b'test16k.wav' # π: added b
writewav(y, fs, nbit, b"y_test.wav") # π: added b
writewav(ya, fs, nbit, b"ya_test.wav") # π: added b
Now those lines return a Bytes
type for both Python2 and Python3.
Now python3 test.py
completes! I now have extra 2 files:
-rw-r--r-- 1 pi staff 121444 29 Oct 10:47 y_test.wav
-rw-r--r-- 1 pi staff 121444 29 Oct 10:47 ya_test.wav
So I think this means it is working.
π