Post Reply 

python fu gimp_file_load cant open file

Jan 21, 2011, 19:53
Post: #1
python fu gimp_file_load cant open file
Hi i have this batch script that open all images in a folder (with glob) an modificantes them (gimp_file_load), in ubuntu it worked well but now in windows 7 its having problems with file names with unicode characters like áéíñ... i tried with file_name.encode() or unicode(file_name) or u"%s"file_name... it just gives me anothe error... here is the Traceback :

Code:
Traceback (most recent call last):
  File "C:\Program Files\GIMP-2.0\lib\gimp\2.0\python\gimpfu.py", line 692, in response
    dialog.res = run_script(params)
  File "C:\Program Files\GIMP-2.0\lib\gimp\2.0\python\gimpfu.py", line 353, in run_script
    return apply(function, params)
  File "C:\Users\messuti.edd\.gimp-2.6\plug-ins\dir_copy_no_bg.py", line 69, in batch_copy_no_bg
    image = pdb.gimp_file_load(file_name, file_name)
RuntimeError: No se ha podido abrir «C:\Users\messuti.edd\Desktop\imagenes principales - copia\Horno El�ctrico, Oster Digital 31 L.jpg» para lectura: Invalid argument

Have Windows 7 - GIMP 2.6.11 - Python 2.6.6[/quote]

thanks a lot, Eduardo
Find all posts by this user
Quote this message in a reply
Jan 21, 2011, 21:19
Post: #2
RE: python fu gimp_file_load cant open file
From what I understand of the source code, there is no filename re-encoding of filenames in the Gimp code. The file is loaded using a call to "g_fopen()". g_fopen() is part of a set of functions in glib that (I quote their doc) "wrap the common POSIX functions dealing with filenames (g_open() , g_rename() , g_mkdir() [...]). The point of these wrappers is to make it possible to handle file names with any Unicode characters in them on Windows without having to use ifdefs and the wide character API in the application code."

So my guess is that what it is expecting is the string of bytes returned by Windows system calls, and NTFS uses UTF-16. But that's only a guess. Maybe the person who maintains gimp-win has a more accurate answer. or ask on the gimp-developer mailing list (https://lists.xcf.berkeley.edu/mailman/l...-developer)

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Setting text markup from python script Burbly 3 210 Sep 16, 2014 13:41
Last Post: ofnuts
  Python-Fu Script Not Registering image_artist 2 189 Sep 14, 2014 13:24
Last Post: image_artist
  Bashing my head - Batch Python Script nmiltner 3 214 Sep 5, 2014 07:03
Last Post: ofnuts
  Help with python script and drawables nmiltner 5 279 Aug 28, 2014 16:09
Last Post: nmiltner
  G'MIC with python-fu? Vash Stampida 2 267 Aug 22, 2014 22:12
Last Post: Vash Stampida

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS