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?
|