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 :

Traceback (most recent call last):
  File "C:\Program Files\GIMP-2.0\lib\gimp\2.0\python\", line 692, in response
    dialog.res = run_script(params)
  File "C:\Program Files\GIMP-2.0\lib\gimp\2.0\python\", line 353, in run_script
    return apply(function, params)
  File "C:\Users\messuti.edd\.gimp-2.6\plug-ins\", 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 (

Now answering your questions on
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
  Loading PythonFu Plugin: ImportError for .../python/ (GIMP 2.8.22/OSX/Py2.7.9) joroek 1 260 Jul 11, 2017 07:26
Last Post: ythgilb
  Setting text markup from python script Burbly 1 393 Sep 16, 2014 12:29
Last Post: Burbly
  Python-Fu Script Not Registering image_artist 1 356 Sep 14, 2014 13:24
Last Post: image_artist
  Bashing my head - Batch Python Script nmiltner 1 413 Sep 5, 2014 00:58
Last Post: nmiltner
  Help with python script and drawables nmiltner 3 465 Aug 28, 2014 16:09
Last Post: nmiltner

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS