Unicode filenames

Bob van der Poel bob at mellowood.ca
Sat Dec 7 11:50:05 EST 2019


On Sat, Dec 7, 2019 at 4:00 AM Barry Scott <barry at barrys-emacs.org> wrote:

>
>
> > On 6 Dec 2019, at 18:17, Bob van der Poel <bob at mellowood.ca> wrote:
> >
> > I have some files which came off the net with, I'm assuming, unicode
> > characters in the names. I have a very short program which takes the
> > filename and puts into an emacs buffer, and then lets me add information
> to
> > that new file (it's a poor man's DB).
> >
> > Next, I can look up text in the file and open the saved filename.
> > Everything works great until I hit those darn unicode filenames.
>
> Yes the names you download are unicode.
> All OS can save that filename to disk these days.
> Can you see the file on disk with the name you expect?
>
> What OS are you using?
>
> >
> > Just to confuse me even more, the error seems to be coming from a bit of
> > tkinter code:
> > if sresults.has_key(textAtCursor):
> >        bookname = os.path.expanduser(sresults[textAtCursor].strip())
> >
> > which generates
> >
> >  UnicodeWarning: Unicode equal comparison failed to convert both
> arguments
> > to Unicode - interpreting them as being unequal  if
> > sresults.has_key(textAtCursor):
>
> What version of python are you using? Peter only managed to get the error
> with python 2.
>
> Do you get the error with python 3?
>
>
I'm running this program on Linux (Ubuntu 19.10) and Python2.

>
>
> > I really don't understand the business about "both arguments". Not sure
> how
> > to proceed here. Hoping for a guideline!
>
>
I've taking the coward's way out and renamed the 1/2 dozen files. Seems
that it is when I grab a filename from the DB it is in unicode and the the
textAtCursor() and then I am trying to open that file using a fork to a
pdf-display program. This is all Q&D stuff so I'm going to file it under
"mysteries of life" and live with it :)

Thanks all!

-- 

**** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob at mellowood.ca
WWW:   http://www.mellowood.ca


More information about the Python-list mailing list