Hello,
I’m trying to open a Sentinel-2 L2A .zip
product using a Python script with snappy
. The problem is that when running:
product = ProductIO.readProduct(sentinelPath + '/' + productTitle + '.zip')
the script hangs indefinitely, with no error message or exception. Even print()
statements placed before that line are never shown. The same .zip
file opens fine in SNAP Desktop.
This issue started occurring around April 25, 2025, without any known intentional changes in my setup.
Environment:
- SNAP: 11.0.0
- snappy: 1.1.10
- Python: 3.6.15 (executed as script, not in Jupyter)
- GDAL: 3.4.1
- OS: Ubuntu 20.04.5 LTS
- Product: Sentinel-2 L2A (SAFE Compact
.zip
)
Things I have tried (unsuccessfully):
- Switching Python binaries (
python3
,python3.6
) - Confirming that the Python interpreter used in the subprocess is the same as the main script
- Running the script directly in a terminal (works fine) instead of via subprocess
- Creating a dummy class with a simple
print()
and calling it instead: it runs fine (both are in the same folder)
Code snippet (where execution hangs):
python
CopiarEditar
def clipSentinelImage(productTitle, date, error):
globalParameters = loadParameters()
# Clip configuration
SubsetOp = esa_snappy.jpy.get_type("org.esa.snap.core.gpf.common.SubsetOp")
esa_snappy.GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()
# Product information
sentinelPath = globalParameters["sentinelPath"]
sentinelRelativePath = getSentinelRelativePath_2023(date)
sentinelPath = sentinelPath + "/" + sentinelRelativePath
print("[INFO] CLIP")
# ❗ This line never returns
product = ProductIO.readProduct(sentinelPath + "/" + productTitle + ".zip")
parameters = HashMap()
parameters.put("targetResolution", 10)
# More code here
Has anyone experienced this kind of behavior? Could it be related to Java or snappy
initialization not working properly when called from a subprocess?
Any suggestions would be greatly appreciated. Thanks!