ProductIO Import Error while using snappy in python

while using snappy, ProductIO is not getting import.

hi, can you be more specific over the error ?

I am getting an “import error in ProductIO” while using snappy in python. Can you help?

Only if you provide more information, e.g. a snippet of your source code.
Helpful can also be other threads in this forum:

This is a simple code I tried, and its showing import error : “ImportError: cannot import name ProductIO”

Probably it is because of the path. Try an absolute Path to the file.

Where should I point to?

Where snappy is installed. I guess you copied it into the site-packages folder of your Python.
Probably here: C:\Python27\Lib\site-packages\snappy\testdata
Or it is still at C:\Users\<USER_HOME>\.snap\snap-python\snappy\testdata

I moved it to where snappy was installed but still its showing the same error.
Is it something related to jpy?

C:\Python27\Lib\site-packages\snappy , this is the location where snappy is installed.

I had another look at the error message.
The problem is already the import of ProductIO.
Then something is probably wrong with the snappy installation.

In the snappy folder in the site-packages directory should be a file named snappyutil.log. Could you attach it here, please?

But still, absolute paths should be used. Then the script will work no matter where you invoke it.

No, there’s no such file named snappyutil.log inside the site-packages.

Then something went wrong during the configuration.
Even if you did already, could you follow this guide: Configure Python to use the SNAP-Python snappy interface Maybe it will work then.

Sir, I followed all the configuration steps, still its not able to import ProductIO. I am getting the same error.

1 Like

It is able to import only the packages which are not inside any sub folder. It shows error for any package inside any sub folder. And also, I have not found ProductIO inside snappy anywhere. Is the problem because of this?

do you have other instances of Python installed on this computer?

Maybe the wrong installation gets called when you type “Python”. Plus, there is a second package called snappy which has different classes. What happens when you type

from snappy import CompressError

If this gives you no error, the wrong snappy is imported.

Try moving the directory of your python installation to the top of your PATH variable so it gets called first.

I have set the path again and still its the same error.

Is it a problem with python 2.7 version?

no, Python 2.7 is fine actually.
Are you sure that there are no other versions of python installed?

Did you try
from snappy import CompressError