Skip to content

python3 compat; pep8 linting#8

Open
pkmital wants to merge 4 commits into
bregmanstudio:masterfrom
pkmital:master
Open

python3 compat; pep8 linting#8
pkmital wants to merge 4 commits into
bregmanstudio:masterfrom
pkmital:master

Conversation

@pkmital
Copy link
Copy Markdown
Contributor

@pkmital pkmital commented Feb 19, 2016

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.

@pkmital pkmital mentioned this pull request Feb 2, 2017
@rcythr
Copy link
Copy Markdown

rcythr commented Sep 11, 2017

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 "//".

@pkmital
Copy link
Copy Markdown
Contributor Author

pkmital commented Sep 11, 2017

Good call. Running the tool 2to3 on everything should catch those sort of things and potentially other issues.

@rcythr
Copy link
Copy Markdown

rcythr commented Sep 11, 2017

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.

@weefuzzy
Copy link
Copy Markdown

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants