Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'mrab': 0.05; 'string.': 0.05; '(python': 0.07; '-*-': 0.07; 'subject:file': 0.07; 'subject:skip:s 10': 0.07; 'utf-8': 0.07; '(unicode': 0.09; 'coding:': 0.09; 'encode': 0.09; 'tackle': 0.09; 'truncated': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'windows': 0.15; '*and': 0.16; '*with': 0.16; '->': 0.16; 'codec': 0.16; 'i.e': 0.16; 'ioerror:': 0.16; 'ordinal': 0.16; 'party)': 0.16; 'skip:u 50': 0.16; 'skip:u 60': 0.16; 'skip:u 70': 0.16; 'string:': 0.16; 'syntaxerror:': 0.16; 'subject:python': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'library': 0.18; 'all,': 0.19; 'import': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'bytes': 0.24; 'exists': 0.24; 'unicode': 0.24; 'cc:2**0': 0.24; 'handling': 0.26; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'character': 0.29; "doesn't": 0.30; 'characters': 0.30; 'skip:( 40': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; '(which': 0.31; 'code': 0.31; 'getting': 0.31; "skip:' 10": 0.31; 'file': 0.32; 'url:python': 0.33; '(most': 0.33; 'raw': 0.33; 'third': 0.33; 'problem': 0.35; "can't": 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; '8bit%:17': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'possible': 0.36; 'url:org': 0.36; 'should': 0.36; 'skip:& 10': 0.38; 'pm,': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'skip:p 20': 0.39; 'url:mail': 0.40; 'how': 0.40; 'even': 0.60; 'skip:u 10': 0.60; 'read': 0.60; 'skip:c 50': 0.60; 'mentioned': 0.61; 'first': 0.61; 'name': 0.63; 'happen': 0.63; 'special': 0.74; '8bit%:24': 0.84; 'fortunately,': 0.84; 'replay': 0.84; 'stat': 0.84; 'treating': 0.84; '*best': 0.91; 'regards*': 0.91; '8bit%:18': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geekschicago.com; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=pSeuSeSe6DGYChLXuWxSkzKGa0QDZ+WZYCR6mPNAywc=; b=d/WkUypqANoHRCS6ox3KS/ysnfeUCisBriQDTl8zUocxCEIt1KTwKJwK6rsXrW9TQu dBbb51HlXacmdhffYBYyGgeSU7QaIgq36eaOrXEdbNqoajtd8ltVFLS6PX8igxx1WgOe Os80mqyspNeCbeSyQAVaAtZpfMFjJ0+DxkfrE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=pSeuSeSe6DGYChLXuWxSkzKGa0QDZ+WZYCR6mPNAywc=; b=QzGe2mtP83TCZJYU9Ro31aY5lOPcYQDz6E29mRjLrUkGPl7e/JzRQc5lW5HjsG19mf aeLMVX668yaYgcU+d1g7hCHpyfBW/vHl6JF9ESJeHGvlU2cFiggMc2hYB4qAQC/5P9VR A9hOVmd8On39L3d+smq+YoUo2tPLoEmxcGNfJ1KcIDG9+5BXC7z78FxZ1XNkPkmbTowy O6H3ErLb5LYY4r4RsSBwV94CLr1GrBbSEfDFOo38vMh1digIr75Syq1/xrKYX69apuKr +/pT4/YpBJ38YVjEVjciUMkvbRQvXgAUwoI+ZZ928uW68jxckSfeQfuS83Pq4mYsOOY2 /Hyw== X-Gm-Message-State: ALoCoQnudeE5xpY4McrBUkazd3ftUXp+4rdBwUAiyvr/9ue7sToE6tkbR/0rm8fNuEx3IvZF5155 X-Received: by 10.224.44.14 with SMTP id y14mr65522496qae.34.1408455040474; Tue, 19 Aug 2014 06:30:40 -0700 (PDT) MIME-Version: 1.0 Sender: furqan@geekschicago.com X-Originating-IP: [202.166.163.98] In-Reply-To: <53F34F55.5080304@mrabarnett.plus.com> References: <53F32F8E.6010502@mrabarnett.plus.com> <53F34F55.5080304@mrabarnett.plus.com> From: Furqan wasi Date: Tue, 19 Aug 2014 18:30:00 +0500 X-Google-Sender-Auth: NJydZQersFSfiGTIBgio8y6ANlE Subject: Re: python scikits.audiolab Sndfile special chars in file name To: MRAB Content-Type: multipart/alternative; boundary=047d7bdc8d5e5f0dfc0500fb7e4c Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 316 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408455043 news.xs4all.nl 2842 [2001:888:2000:d::a6]:40712 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76566 --047d7bdc8d5e5f0dfc0500fb7e4c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable *with code * # -*- coding: UTF-8 -*- import numpy, os from scikits.audiolab import Sndfile from os import walk, path, stat file =3D u"C:/Users/Furqan/Desktop/=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1=8CRefe= rence/1.wav" track1 =3D file track_one_file_obj =3D Sndfile(track1, 'r') Getting this Traceback (most recent call last): File "D:/python/Interstitial Project/test.py", line 9, in track_one_file_obj =3D Sndfile(track1, '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 with code * # -*- coding: UTF-8 -*- import numpy, os from scikits.audiolab import Sndfile from os import walk, path, stat file =3D u"C:/Users/Furqan/Desktop/=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1=8CRefe= rence/1.wav" track1 =3D file track_one_file_obj =3D Sndfile(track1.decode('utf-16'), 'r') print(track_one_file_obj) Traceback (most recent call last): File "D:/python/Interstitial Project/test.py", line 9, in track_one_file_obj =3D Sndfile(track1.encode('utf-8'), '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/=E6=9F=A5=E6=89=BE=E5= =95=8F=E9=A1=8CReference/1.wav ->error while opening file C:/Users/Furqan/Desktop/=E6=9F=A5=E6=89=BE=E5=95= =8F=E9=A1=8CReference/1.wav -> System error : The system cannot find the path specified. *so what you think , what i should do is it possible to tackle to problem ?= * On Tue, Aug 19, 2014 at 6:21 PM, MRAB wrote: > > On 2014-08-19 13:14, Furqan wasi wrote: > >> >> Getting this >> >> file =3D ur"C:\Users\Furqan\Desktop\=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1=8C= Reference\1.wav" >> SyntaxError: (unicode error) 'rawunicodeescape' codec can't decode bytes >> in position 2-3: truncated \uXXXX >> >> Ouch! That's Python 2 treating \U as the start of a Unicode escape, eve= n > though it's in a raw string. That doesn't happen in Python 3 (which is wh= at > I use nowadays). > > Fortunately, Windows will accept / instead of \ in paths, which also mean= s > that you don't have to make it a raw string: > > file =3D u"C:/Users/Furqan/Desktop/=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1=8CRe= ference/1.wav" > > > >> On Tue, Aug 19, 2014 at 4:05 PM, MRAB > > wrote: >> >> On 2014-08-19 09:05, Furqan wasi wrote: >> >> *Hi Mark and all, * >> >> >> Thanks for the replay i appreciate your help but the >> problem i >> have is not with the FileNotFoundError exception handling >> because the >> file exists but the problem is that the library libsndfile/Sndfi= le >> (python third party) which is child class/module of >> scikits.audiolab >> (python third party) is not reading file with special >> character in its >> path and name , i need some help to in how to make library >> libsndfile/Sndfile to read file with special character in it i.= e >> C:\Users\Furqan\Desktop\test\=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1= =8Cdaw\=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1=8Cd.wav, as i >> mentioned >> in my first email >> >> I recommend that you use Unicode strings instead of bytestrings: >> >> track1 =3D ur'C:\Users\Furqan\Desktop\test\=E6=9F=A5=E6=89=BE=E5=95= =8F=E9=A1=8Cdaw\=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1=8Cd.wav' >> >> > -- > https://mail.python.org/mailman/listinfo/python-list > --=20 *Best Regards* Furqan Wasi *AVPreserve * --047d7bdc8d5e5f0dfc0500fb7e4c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
with code=C2=A0

# -*- coding: UTF-8 -*-
impor= t numpy, os

from scikits.audiolab import Sndfile
from os import walk, path, stat
file =3D u"C:/Users/Furqan/Desktop/=E6=9F=A5=E6=89=BE=E5=95= =8F=E9=A1=8CReference/1.wav"
track1 =3D file

track_one_file_obj =3D Sndfile(tra= ck1, 'r')

Getting this=C2=A0
Traceback (most recent call l= ast):
=C2=A0 File "D:/python/Interstitial Project/test.py", line 9, in = <module>
=C2=A0 =C2=A0 track_one_file_obj =3D Sndfile= (track1, 'r')
=C2=A0 File "_sndfile.pyx", line 471, in scikits.audio= lab.pysndfile._sndfile.Sndfile.__init__ (scikits\audiolab\pysndfile\_sndfil= e.c:4092)
UnicodeEncodeError: 'ascii' codec can't encode chara= cters in position 24-27: ordinal not in range(128)

and=C2=A0
with code=C2=A0


# -*- coding= : UTF-8 -*-
import numpy, os

from scikits.a= udiolab import Sndfile
from os import walk, path, stat
file =3D u"C:/Users/Furqan/Desktop/=E6=9F=A5=E6=89= =BE=E5=95=8F=E9=A1=8CReference/1.wav"
track1 =3D file


track_one_file_obj =3D Sndfile(track1.decode('utf-16'), 'r&#= 39;)
print(track_one_file_obj)
=

Traceback (most recent c= all last):
=C2=A0 File "D:/python/Interstitial = Project/test.py", line 9, in <module>
=C2=A0 =C2=A0 track_one_file_obj =3D Sndfile(track1.encode('= utf-8'), 'r')
=C2=A0 File "_sndfile.pyx", line 488, in scikits.audiolab.pysndfi= le._sndfile.Sndfile.__init__ (scikits\audiolab\pysndfile\_sndfile.c:4251)
IOError: error while opening C:/Users/Furqan/Desktop/=E6=9F=A5=E6=89=BE=E5= =95=8F=E9=A1=8CReference/1.wav
->error while opening file C:/Users/Furqan/Deskto= p/=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1=8CReference/1.wav
-> System = error : The system cannot find the path specified.

so what you think , what i should do is it pos= sible to tackle to problem ?




On Tue, Aug 19, 2014 at 6:21 PM, MRAB <python@mrabarnett.= plus.com> wrote:

On 2014-08-19 13:14, Furqan wasi wrote:

Getting this

file =3D ur"C:\Users\Furqan\Desktop\=E6=9F=A5=E6=89=BE=E5=95=8F= =E9=A1=8CReference\1.wav"
SyntaxError: (unicode error) 'rawunicodeescape' codec can't dec= ode bytes in position 2-3: truncated \uXXXX

Ouch! That's Python 2 treating \U as the start of a Unicode escape, eve= n though it's in a raw string. That doesn't happen in Python 3 (whi= ch is what I use nowadays).

Fortunately, Windows will accept / instead of \ in paths, which also means = that you don't have to make it a raw string:

file =3D u"C:/Users/Furqan/Desktop/=E6=9F=A5=E6=89=BE=E5=95=8F= =E9=A1=8CReference/1.wav"



On Tue, Aug 19, 2014 at 4:05 PM, MRAB <python@mrabarnett.plus.com <mailto:python@mrabar= nett.plus.com>> wrote:

=C2=A0 =C2=A0 On 2014-08-19 09:05, Furqan wasi wrote:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 *Hi Mark and all, *


=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Thanks for t= he replay i appreciate your help but the
=C2=A0 =C2=A0 =C2=A0 =C2=A0 problem i
=C2=A0 =C2=A0 =C2=A0 =C2=A0 have is not with the FileNotFoundError exceptio= n handling
=C2=A0 =C2=A0 =C2=A0 =C2=A0 because the
=C2=A0 =C2=A0 =C2=A0 =C2=A0 file exists but the problem is that the library= libsndfile/Sndfile
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (python third party) which is child class/modul= e of
=C2=A0 =C2=A0 =C2=A0 =C2=A0 scikits.audiolab
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (python third party) is not reading file with s= pecial
=C2=A0 =C2=A0 =C2=A0 =C2=A0 character in its
=C2=A0 =C2=A0 =C2=A0 =C2=A0 path and name , i need some help to in how to m= ake library
=C2=A0 =C2=A0 =C2=A0 =C2=A0 libsndfile/Sndfile to read file with special ch= aracter in it=C2=A0 i.e
=C2=A0 =C2=A0 =C2=A0 =C2=A0 C:\Users\Furqan\Desktop\test\=E6=9F=A5= =E6=89=BE=E5=95=8F=E9=A1=8Cdaw\=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1=8Cd.wav, a= s i
=C2=A0 =C2=A0 =C2=A0 =C2=A0 mentioned
=C2=A0 =C2=A0 =C2=A0 =C2=A0 in my first email

=C2=A0 =C2=A0 I recommend that you use Unicode strings instead of bytestrin= gs:

=C2=A0 =C2=A0 track1 =3D ur'C:\Users\Furqan\Desktop\test\=E6=9F= =A5=E6=89=BE=E5=95=8F=E9=A1=8Cdaw\=E6=9F=A5=E6=89=BE=E5=95=8F=E9=A1=8Cd.wav= '


--
https://mail.python.org/mailman/listinfo/python-list



--
=

Best Regards

Furqan Wasi

AVPreserve=C2=A0

--047d7bdc8d5e5f0dfc0500fb7e4c--