It is currently Thu Jul 04, 2024 3:18 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Working with unicode filenames
PostPosted: Sat Oct 30, 2021 8:25 pm  (#1) 
Offline
GimpChat Member

Joined: Oct 10, 2014
Posts: 36
I like to share with you my experience in handling unicode pathnames. I had trouble with this

import os
image_filename = pdb.gimp_image_get_filename(image)
(fileroot,filename)=os.path.split(image_filename)
fileroot+="\\output"
if not os.path.isdir(fileroot):
os.makedirs(fileroot)

The code would fail if the filename contains unicode. The simple fix is to add a unicode conversion right after the image_get_filename and everything works.

import os
image_filename = pdb.gimp_image_get_filename(image)
image_filename = unicode(image_filename, "utf-8", errors="ignore")
(fileroot,filename)=os.path.split(image_filename)
fileroot+="\\output"
if not os.path.isdir(fileroot):
os.makedirs(fileroot)

I hope this is useful info to others.


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts G'MIC version: 2.9.1 not working...?

2

No new posts Attachment(s) Resynthesizer Not Working

2

No new posts Attachment(s) Gimpchat not working...

25

No new posts Bevel not working

7

No new posts Help!!! Heal Tool not working

5



* Login  



Powered by phpBB3 © phpBB Group