Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ofn-preset-guides
#21
Hi.
Just tried.
It works in one of my systems, but not in the other. The difference is that the second one has an "ñ" in the GIMP data path.
Reply
#22
Can Gimp write in that directory? The script creates a .log file when it registers (so you can track problem). So have you got an ofn-preset-guides.log file there and if so what are the contents (and have you got one in the version that works)?
Reply
#23
Thank you for the update Ofnuts Smile
Reply
#24
Just wondering why some scripts start
# -*- coding: iso-8859-15 -*-
and others
# -*- coding: utf-8 -*-

I know one is for character sets and the other unicode but how is the choice made and why some scripts (not yours) just leave that line out ?
Reply
#25
In my scripts, depends which previous one I use to get started with the boiler plate. I tend to favor unicode, but still have a few ISO-8859 ones left.

If there is nothing, it can work if your script is using only plain ASCII, or the default encoding defined for the system/user where it's running.

In the case at hand, the ñ comes from data, not the code...
Reply
#26
(06-20-2021, 07:12 PM)Ofnuts Wrote: Can Gimp write in that directory? The script creates a .log file when it registers (so you can track problem). So have you got an ofn-preset-guides.log file there and if so  what are the contents (and have you got one in the version that works)?

Hi,

There is no .log file created. In the working system there is a log file, but in the second system there is not a non ASCII letters in the path. That's the only difference I can spot.

This is not working:

C:\Users\Iñigo\AppData\Roaming\GIMP\2.10\plug-ins\ofn-preset-guides
Reply
#27
Can you try this in the Python console (Filters ➤ Python-fu ➤ Console)

Copy/paste all of this to the pyhon console (the leading spaces in the last line are important), and then strike enter until the prompt returns to ➤>
Code:
import os.path
fname=os.path.join(gimp.directory,'testfile.dat')
print fname
with open(fname,'w') as dat:
    dat.write('Test successful')
If you get error messages, copy them here. If you don't check that the file whose name has been printed has been indeed created and contains Test successful.
Reply
#28
import os.path
File "<input>", line 1
rt os.path
^
SyntaxError: invalid syntax
➤> fname=os.path.join(gimp.directory,'testfile.dat')
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'os' is not defined
➤> print fname
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'fname' is not defined
➤> with open(fname,'w') as dat:
... dat.write('Test successful')
Reply
#29
[quote]
import os.path
File "<input>", line 1
rt os.path
^
[/code]
This is wrong, obviously the "import" was truncated, so the rest the command didn't do what I want.
Can you retry with these three:
Code:
import os.path
Code:
fname=os.path.join(gimp.directory,'testfile.dat')
print fname
Code:
with open(fname,'w') as dat:
   dat.write('Test successful')

And d'ont process tp the next of the previous one didn't work?
Reply
#30
Sorry for the mistake.

Here you have again:

GIMP 2.10.24 Python Console
Python 2.7.18 (default, Apr 20 2020, 16:57:11) [GCC 9.3.0 64 bit (AMD64)]
➤> import os.path
➤> fname=os.path.join(gimp.directory,'testfile.dat')
➤> print fname
C:\Users\Iñigo\AppData\Roaming\GIMP\2.10\testfile.dat
➤> with open(fname,'w') as dat:
... dat.write('Test successful')
...

Nothing is written in the plugins folder..
Reply


Forum Jump: