-
Notifications
You must be signed in to change notification settings - Fork 81
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
ValueError: could not convert string to float: '1.41M' #119
Comments
Hello @Aarrtteemm123. Can you please give us the output of soxi for the same file? |
import sox print(sox.file_info.soxi('inputs files/input2.wav','B')) # 1.41M |
Sorry for the confusion. What i was trying to ask what: what happens when you run soxi on this file from the command line prompt, outside of a Python session? |
C:\Users\USER_ARTEM\Desktop\Python\test>sox --i input.wav Input File : 'input.wav' C:\Users\USER_ARTEM\Desktop\Python\test>soxi input.wav C:\Users\USER_ARTEM\Desktop\Python\test> |
I'm also getting this error trying to use sox.file_info.info, because the greek_prefixes string isn't being parsed correctly. In my case, the bitrate value from the MP3 file is 64.1K (upper case) instead of 64.1k (lower case), which it seems was expected. (See the last if...else block in the code below). I would suggesting the following:
Source code from sox.file_info (https://pysox.readthedocs.io/en/latest/_modules/sox/file_info.html):
|
Previous version of parsing was unable to get valid content eg. when `output` ends with '\r' character what is possible in cross platform environment. New parser version is resistant for any line ending. Moreover parser is insensistive for prefix letter size, see bug: marl#119 (comment) Signed-off-by: Karol Trzcinski <k.trzcinski95@gmail.com>
import sox
sox.file_info.info('inputs files/input2.wav') // ValueError
Full error
Traceback (most recent call last):
File "C:/Users/USER_ARTEM/Desktop/Python/test/test2.py", line 4, in
sox.file_info.info('inputs files/input2.wav')
File "C:\Users\USER_ARTEM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sox\file_info.py", line 357, in info
'bitrate': bitrate(filepath),
File "C:\Users\USER_ARTEM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sox\file_info.py", line 64, in bitrate
return float(output[:-1])
ValueError: could not convert string to float: '1.41M'
The text was updated successfully, but these errors were encountered: