using python scripts wiht gimp 2.10 flatpak - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: using python scripts wiht gimp 2.10 flatpak (/Thread-using-python-scripts-wiht-gimp-2-10-flatpak--7968) |
using python scripts wiht gimp 2.10 flatpak - jacques_duflos - 04-20-2023 Hi there, I recently installed ubuntu 22.10 and gimp 2.10 via flatpak. I tried to create a script with python as I was used to on previous installations, but I cant get gimp to acknowledge my scripts. I checked the folders in the preference menu, I had to create the folder because it was not done by the installation for some reason. here is the script of my .py file Code: :~/.config/GIMP/2.10/scripts$ cat clothfy.py some ideas of troubleshooting I can think of : - this example of python script is very old. Where could I find a more recent one ? - flatpak is a kind of sandbox isn't it ? is there a complementary operation I should do for gimp to accept to read a .py file ? - the first line of the code says /usr/bin/python . but my /usr/bin folder does not contain any python file or folder. It contains python3, python3.10, python3-config and other stuffs starting with python3. Is it an issue ? Any idea someone ? RE: using python scripts wiht gimp 2.10 flatpak - Ofnuts - 04-20-2023 The flatpak app is sandboxed, it has its own view of the file system. What it sees as /usr is actually in the flatpack tree, which is why you don't see some folders on your system. Other things to know about the flatpak version:
IIRC you can normally put your script/plugins in your own Gimp profile (~/.config/GIMP/2.10/ IIRC). If not you can add a folder in Preferences/Folders/Plug-ins and put your script there (hint: put some recognizable files in the folder before you pick it from Gimp, so you will know if you see a folder from the flatpak or a "real" folder). Make sure that your script has the executable flag, and no syntax errors. If you start Gimp from a terminal, Python errors will show in the terminal. You can use a print '********************' at the beginning of the code to see if it is at least called and executed. You can use script from my collection as examples (and steal all the code you want). Beware that some may use some tricks when registering several functions (I hate to repeat myself). Usually the smaller ones (check the ZIP size) are the simplest. In any case you can always ask. RE: using python scripts wiht gimp 2.10 flatpak - rich2005 - 04-21-2023 Some observations. There is already a clothify but a script-fu For a flatpak buried in /var/lib/flatpak/app/org.gimp.GIMP/x86_64/stable/active/files/share/gimp/2.0/scripts/ The python version as posted gives an error on my installation. Traceback (most recent call last): File "/home/rich/gimp-flat-plugin/clothify.py", line 5, in <module> have_gimp11 = gimp.major_version > 1 or \ but there is a python version here: https://gitlab.gnome.org/GNOME/gimp/-/tree/b52cdf4c90800452aa9717d57398ba72a5819d2a/plug-ins/pygimp/plug-ins For any Gimp, especially flatpak, if you use it frequently and add resources, make an easy to find folder and add to the resource path. [attachment=9716] Both scm and py working here, can't see any difference in results. [attachment=9717] Edit: Quote:I had to create the folder because it was not done by the installation for some reason. I have come across this before, seems linked to having a Gimp user profile (~/.config/GIMP) left over from an existing/old installation. If you start the flatpak in a terminal flatpak run org.gimp.GIMP rather than from the menu you might get a clue from any error message. RE: using python scripts wiht gimp 2.10 flatpak - jacques_duflos - 05-04-2023 Hi, thanks for the responses. What does IIRC stand for ? In edit>preferences>folders, any of the path listed existed in my computer. If I try to create them or add a new path and put python files in it, it won't work. (04-20-2023, 09:59 PM)Ofnuts Wrote: IIRC you can normally put your script/plugins in your own Gimp profile (~/.config/GIMP/2.10/ IIRC). That was the solution all along ! I dont know why, but the files in this folder are taken into account, besides it is not part of the path listed in edit>preferences>folders. Fun fact, when I make a syntax mistake, the output given by the gimp at startup clams that the file is in the folder listed in the gimp preferences: Code: jacques@france:~/.config/GIMP/2.10/plug-ins$ gedit python-test-error.py rich Wrote:seems linked to having a Gimp user profile (~/.config/GIMP) left over from an existing/old installation.Yes, I installed the "normal" version of gimp before uninstalling it and install the flatpak version. Long story short, it works, and it's good enough for me. But I am very puzzled by the way flatpak deals with path and folders. thank you both |