python scikits.audiolab Sndfile special chars in file name

Furqan wasi furqan at avpreserve.com
Tue Aug 19 02:52:37 EDT 2014


*yes you are right , it through's this exception that "The system cannot
find the path specified." but in fact it exists , so thats why i tried to
pass the file name by handling file name by applying different non utf
character solution but no of those work *

*track_one_file_obj = Sndfile(track1, 'r')*

*Traceback (most recent call last):*
  File "D:/python/Interstitial Project/test.py", line 10, in <module>
    track_one_file_obj = Sndfile(track1, 'r')
  File "_sndfile.pyx", line 488, in
scikits.audiolab.pysndfile._sndfile.Sndfile.__init__
(scikits\audiolab\pysndfile\_sndfile.c:4251)
IOError: error while opening C:\Users\Furqan\Desktop\查找問題Reference\1.wav
 ->error while opening file C:\Users\Furqan\Desktop\查找問題Reference\1.wav
-> System error : The system cannot find the path specified.

*and gives the exception if use this code *

 *track_one_file_obj = Sndfile(track1.decode('utf-8'), 'r')*
*print(track_one_file_obj)*

Traceback (most recent call last):
  File "D:/python/Interstitial Project/test.py", line 28, in <module>
    track_one_file_obj = Sndfile(track1.decode('utf-8'), 'r')
  File "_sndfile.pyx", line 471, in
scikits.audiolab.pysndfile._sndfile.Sndfile.__init__
(scikits\audiolab\pysndfile\_sndfile.c:4092)
UnicodeEncodeError: 'ascii' codec can't encode characters in position
24-27: ordinal not in range(128)

and gives exception if i use
*track_one_file_obj = Sndfile(track1.encode('utf-8'), 'r')*


*print(track_one_file_obj)*
Traceback (most recent call last):
  File "D:/python/Interstitial Project/test.py", line 19, in <module>
    track_one_file_obj = Sndfile(track1.encode('utf-16'), 'r')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 24:
ordinal not in range(128)

so far what i am getting that the Sndfile or libsndfile library dose not
support file name which has special character in its name , so i am a bit
stuck with this

*Thanks *



On Tue, Aug 19, 2014 at 6:42 AM, Chris Angelico <rosuav at gmail.com> wrote:

> On Tue, Aug 19, 2014 at 1:34 AM, Furqan wasi <furqan at avpreserve.com>
> wrote:
> > except:
> >     print('Simple didnt work')
> >     pass
>
> Drop all of these bare excepts. Let the exceptions get printed.
> Believe you me, they are a LOT more helpful than "didnt work".
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 

*Best Regards*

Furqan Wasi
*AVPreserve *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140819/15ed9577/attachment.html>


More information about the Python-list mailing list