I’ve got what seems to be a simple but frustrating error using snappy within python scripts (Python 3.4.5).
I have a script called process_with_snappy.py that contains a number of functions that use snappy- if I run my script directly, everything is fine - operations like:
Haven’t use GPF that way for a while now, but it should work as import function right away, at least I did not have any trouble in these examples (just ProductIO):
Would like to see how you call the function you are importing to the new python file.
One more thing could be worth trying and that is checking for “environment variables” for python on windows or the console functionality of import “anything” for python in linux as well.
with the python config you should just need the python path, that part seems fine, for GPT you need the SNAP toolbox path as well, but that is not an issue here.
You are importing only the function and not the script you wrote so it should be taking only a part of your code i. e. not the imports so it gets messy.
Thanks for the quick reply - just made your changes and error is the same unfortunately.
Seems like it doesn’t matter whether I import the function or the whole script, as soon as main.py runs, all the libraries import from each script before any code runs. Hence getting the import error straight away before the function is called.
Though in windows the same should go for Ubuntu, still not sure how your processing works and the other not. Do you have any other python instances? Like from ArcGIS, Anaconda, etc.?
Could still be the ArcGIS python instance if it is present or similar other than that I am running out of ideas, you can try to wrap the operators into a new function in the main file and call it, that would be one more thing that could be done, but other than that that it could get more and more complicated.
Yeah different python versions are always funny, I had the trouble with python for the ArcMap as it sort of overwrote the path to my primary python which was pain in the neck and could figured that one out for like two hours.