python3 compat; pep8 linting#8
Conversation
|
You are correct in that with your change the code will compile; however, this alone will not work. Python3 changed the semantics of division. All of the integer division operations need to be changed from "/" to "//". |
|
Good call. Running the tool |
|
I tried that, actually; however, 2to3 doesn't properly catch the division issue. I've started working on a port on my fork of this repo. It seems to work; however, I cannot find any test cases so I cannot be certain it's 100% working. Maybe if I get some time tonight I'll test it by running the set of examples. |
|
Just spent a bit of time on this. In the main body of code getting things python 3 happy are pretty straightforward: stuff that 2to3 catches, plus a few integer division bits. The more complex issues are in sound.py, which does a lot of work to provide wrappers for scikit.audiolab functions if the latter is missing. Quite a bit of this is using strings as bytes, which has changed under python 3 (but is easily updated). However, the fallback wav code was extremely slow for me (~10 m to write a 1m wav file!), and it doesn't seem as if the audiolabs stuff has much prospect of ever being py3 compatible. What I've done on my local repo is rewrite the sound.py functions with pysoundfile instead, which seems to work (although I'm not yet sure if I haven't broken anything else in the process). |
Using Python 3.5.1 so had to change all print functions to use parens and import print_function from future. Should at least allow you to install now w/ python3. Also ran a linter on the files I edited for PEP8.