Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes error loading unicode filenames #223

Merged
merged 1 commit into from
Nov 30, 2016
Merged

Conversation

flokadillo
Copy link
Contributor

This addresses issue #220. Closing the file is now in a try block.

Copy link
Collaborator

@superbock superbock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more places in the code where .close() is used. Maybe it works in these places, but we should at least check if all can handle unicode filenames and write tests accordingly.

@@ -723,6 +724,9 @@ def test_types(self):
self.assertIsInstance(signal, np.ndarray)
self.assertTrue(signal.dtype == np.int16)
self.assertTrue(type(sample_rate) == int)
if sys.version_info[0] == 2:
# test unicode string type (Python 2 only)
signal, sample_rate = load_audio_file(unicode(sample_file))
Copy link
Collaborator

@superbock superbock Oct 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to check this only for Python 2? Shouldn't this be checked for Python 3, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python 3 has no unicode type, therefore I cannot execute unicode(sample_file).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Python 3, all strings are unicode by default.

@flokadillo flokadillo force-pushed the fixes/unicode_filenames branch 2 times, most recently from b2cf5fb to d8092e2 Compare October 25, 2016 15:28
@superbock superbock merged commit f0cf689 into master Nov 30, 2016
@superbock superbock deleted the fixes/unicode_filenames branch November 30, 2016 11:17
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