Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when importing Sentinel2 class on Windows #18

Closed
gperich opened this issue Nov 29, 2022 · 2 comments
Closed

Error when importing Sentinel2 class on Windows #18

gperich opened this issue Nov 29, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@gperich
Copy link
Contributor

gperich commented Nov 29, 2022

Upon importing the Sentinel2 class from eodal.core.sensors import Sentinel2 on my Windows machine, i get the following error message:
File "C:\Users\gperich\python_venvs\eodal\lib\site-packages\eodal\core\utils\geometry.py", line 129, in <module> def multi_to_single_points(point_features: gpd.GeoDataFrame | Path) -> gpd.GeoDataFrame: TypeError: unsupported operand type(s) for |: 'type' and 'type'

The error traces back to the multi_to_single_points function in the geometry.py file in the core\utils folder. I suspect Windows doesn't like the | operation? Or is it a python issue? I am on Python 3.9.7

@lukasValentin
Copy link
Collaborator

Hi @gperich,

this is unfortunately an issue of missing backwards compatibility (regarding the Python version). The | operator was introduced in Python 3.10 instead of the Union operator (from typing import Union).
This means in Python 3.9

def add(a: Union[int, float], b: Union[int, float]):

becomes in Python 3.10

def add(a: int | float, b: int | float):

Unfortunately, back-ward compatibility is not part of Python's development philosophy.

Therefore, the only solution would be to upgrade Python to 3.10+. Sorry for that 😞

@lukasValentin lukasValentin added the bug Something isn't working label Nov 29, 2022
@gperich
Copy link
Contributor Author

gperich commented Nov 29, 2022

oh no! I feared that this might be the cause. Well then, time to install GDAL and all the good stuff again for 3.10...

@gperich gperich closed this as completed Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants