View Single Post
Old 07-08-2021, 11:35 AM   #1
Terry Brown
Enthusiast
Terry Brown began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Jun 2010
Location: Portland, OR
Device: M1 Max Mac Studio, iPad Pro 2018 12.9, iPhone 7
Help with non-standard characters in directory names

I have been working on a python program that retrieves information from my Calibre database and acts as a bookmarking tool for syncing my reading location across multiple devices I use to read multiple formats of ebooks, but that don't sync very reliably.

As part of this, I have accessed cover files within the Calibre library file structure.

I am using macOS. In python, I am using the pillow library (from PIL import Image) to read the cover image, convert to a png thumbnail for my use.

The problem is that characters like single and double quotes, commas, non-ascii characters, and so on mean that I cannot get to some of the directories Calibre creates. A good example is the recent book "Ring Shout" by P. Djèlí Clark--the non-standard characters in the author name mean that the PIL library calls using the path I create don't work.

I have tediously fixed all the current problems by manipulating the author names and book titles in Calibre to remove or change the offending characters--not a good solution.

Anyone know how can I manage this in the Python code?
Terry Brown is offline   Reply With Quote