Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gimp Python-fu 2.7 to launch Python 3 for editing images
#7
Sad 
I still plan to go back to it at some point. It will only become easier to get working as the libraries support more things.

Basically I was trying to launch an install of python 3 that was on my computer from gimp's built in python 2.7. This works just fine.

I would launch it with a command line argument to do the work. This also works just fine.

It would save some file in a folder for gimp python 2.7 to pass back to the plugin. I did not get this far but no reason to think it would not work fine.

In the end it would have a gui with sliders like are easy to make for plugins in gimp. There are like 10 sliders and 4 or so Boolean choices but that would not take too long really.

The sticking point was trying to get all the system variables for python 3 to be correct. The built in 2.7 python has modified variables. It is easy to modify these variables but it is basically impossible to reload those variables once gone.

In theory before launching python 3 I could change all those variables back to what they are for the rest of the system and then launch python 3 so it inherits those variables, or directly set them as a variable when launching python 3. But I never got it working. Tensorflow has a number of dependencies. Cuda, cudnn, numpy, windows visual c++ 2015 tools and more.

As a side note some of this tech is actually starting to get worked into commercial products, though currently it is done with a server processing the images for the user.

one of the code stubs I have saved from when I was working on this a lot is this. I would then try to import tensorflow.


import os, subprocess, sys

d = "environ({'ALLUSERSPROFILE': 'C:\\ProgramData', 'APPDATA': .... all the rest of the environment variable})"

subprocess.Popen(["C:/Users/audov/AppData/Local/Programs/Python/Python36/python.exe"], env=d, shell=True)
Reply


Messages In This Thread
RE: Gimp Python-fu 2.7 to launch Python 3 for editing images - by audovoice - 01-16-2019, 06:21 PM

Forum Jump: