Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76565 > unrolled thread

Re: python scikits.audiolab Sndfile special chars in file name

Started byMRAB <python@mrabarnett.plus.com>
First post2014-08-19 14:21 +0100
Last post2014-08-19 14:21 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python scikits.audiolab Sndfile special chars in file name MRAB <python@mrabarnett.plus.com> - 2014-08-19 14:21 +0100

#76565 — Re: python scikits.audiolab Sndfile special chars in file name

FromMRAB <python@mrabarnett.plus.com>
Date2014-08-19 14:21 +0100
SubjectRe: python scikits.audiolab Sndfile special chars in file name
Message-ID<mailman.13149.1408454486.18130.python-list@python.org>
On 2014-08-19 13:14, Furqan wasi wrote:
>
> Getting this
>
> file = ur"C:\Users\Furqan\Desktop\查找問題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, even 
though it's in a raw string. That doesn't happen in Python 3 (which 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 = u"C:/Users/Furqan/Desktop/查找問題Reference/1.wav"

>
> On Tue, Aug 19, 2014 at 4:05 PM, MRAB <python@mrabarnett.plus.com 
> <mailto:python@mrabarnett.plus.com>> 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/Sndfile
>         (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\查找問題daw\查找問題d.wav, as i
>         mentioned
>         in my first email
>
>     I recommend that you use Unicode strings instead of bytestrings:
>
>     track1 = ur'C:\Users\Furqan\Desktop\test\查找問題daw\查找問題d.wav'
>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web