How to use snappy in a python script?


I am trying to use snappy in a python script but it seems that I am missing a little something because the following code’s result is “python.exe exits with code 1 (0x1)”.

import snappy
from snappy import ProductIO
p = ProductIO.readProduct(‘C:\path\to\snappy-dir\testdata\MER_FRS_L1B_SUBSET.dim’)

Do you know what’s the problem ?



The code looks okay. Maybe it is your configuration.
Ar your SNAP and Python of the same bitness. Both should be 32Bit or 64Bit. But this gives usually different errors.
Can say a bit more about your system. And what you have installed. Also the version of SNAP and Python would be interesting.


sorry for the late reply.

A teacher helped me to solve this problem.
my SNAP and Python are of the same bitness, the problem was from the definiton of the path and the environnement variables.

I added os.environ[‘PATH’] = r’C:\Program Files\QGIS 2.18\bin’ to my script and defined the PYTHONPATH and PYTHONHOME in the environnement variables of the script configuration.

Now it works perfectly!