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

Compatibility Issue with Python 3.9 in mplib v0.2.1 #98

Open
chase6305 opened this issue Oct 15, 2024 · 2 comments
Open

Compatibility Issue with Python 3.9 in mplib v0.2.1 #98

chase6305 opened this issue Oct 15, 2024 · 2 comments

Comments

@chase6305
Copy link

chase6305 commented Oct 15, 2024

Description:

I encountered a compatibility issue while trying to use mplib 0.2.1 with Python 3.9.19. The following error occurs during the import:

TypeError: unsupported operand type(s) for |: 'type' and 'type'

Error Traceback:

Traceback (most recent call last):  
  File ~/anaconda3/envs/py39/lib/python3.9/site-packages/mplib/__init__.py:3  
    from .planner import Planner  
  File ~/anaconda3/envs/py39/lib/python3.9/site-packages/mplib/planner.py:16  
    from .urdf_utils import generate_srdf, replace_urdf_package_keyword  
  File ~/anaconda3/envs/py39/lib/python3.9/site-packages/mplib/urdf_utils.py:136  
    urdf_path: str | Path,  
TypeError: unsupported operand type(s) for |: 'type' and 'type'  

Expected Behavior:

The library should be compatible with Python 3.9 and should not raise a TypeError when importing.

Proposed Solution:

To ensure compatibility with Python 3.9 and earlier versions, I suggest modifying the type hint in urdf_utils.py:

from typing import Union

Change this line:

urdf_path: str | Path

To:

urdf_path: Union[str, Path]

This change should resolve the issue and allow the library to work correctly in Python 3.9.

Environment:

  • Python version: 3.9.19
  • mplib version: 0.2.1
  • Operating System: Ubuntu 20.04

Thank you!

@Lexseal
Copy link
Collaborator

Lexseal commented Oct 15, 2024

Yes that's a good point! We will fix it : )

@Lexseal
Copy link
Collaborator

Lexseal commented Oct 21, 2024

it should be fixed in the nightly build. accidentally pushed main sorry @KolinGuo lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants