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

[BUG] Import error with python <= 3.9 #194

Closed
champystile opened this issue Mar 3, 2024 · 2 comments
Closed

[BUG] Import error with python <= 3.9 #194

champystile opened this issue Mar 3, 2024 · 2 comments
Assignees

Comments

@champystile
Copy link

Describe the bug
When importing pycatia with python 3.9, it raises a TypeError due to an annotation syntax introduced in python 3.10 :

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\...\lib\site-packages\pycatia\__init__.py", line 21, in <module>
    from pycatia.base_interfaces.base_application import catia_application as catia
  File "C:\...\lib\site-packages\pycatia\base_interfaces\base_application.py", line 5, in <module>
    from pycatia.in_interfaces.application import Application
  File "C:\...\lib\site-packages\pycatia\in_interfaces\application.py", line 10, in <module>
    from pycatia.in_interfaces.document import Document
  File "C:\...\lib\site-packages\pycatia\in_interfaces\document.py", line 17, in <module>
    from pycatia.in_interfaces.cameras import Cameras
  File "C:\...\lib\site-packages\pycatia\in_interfaces\cameras.py", line 13, in <module>
    from pycatia.in_interfaces.camera import Camera
  File "C:\...\lib\site-packages\pycatia\in_interfaces\camera.py", line 12, in <module>
    from pycatia.system_interfaces.any_object import AnyObject
  File "C:\...\lib\site-packages\pycatia\system_interfaces\any_object.py", line 13, in <module>
    from pycatia.base_interfaces.pycatia import PyCATIA
  File "C:\...\lib\site-packages\pycatia\base_interfaces\pycatia.py", line 5, in <module>
    from pycatia.cat_logger import create_logger
  File "C:\...\lib\site-packages\pycatia\cat_logger.py", line 9, in <module>
    def has_level_handler(logger: logging.Logger | None):
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

To Reproduce
With python 3.9 and pycatia 0.6.6, import pycatia :

import pycatia

Expected behavior
No exception :)

Desktop (please complete the following information):

  • OS: Windows 11
  • CATIA V5 version: rCxR1 (?)
  • pycatia version: 0.6.6
  • python version: 3.9.18

Additional context
Known solution: replace logging.Logger | None by Optional[logging.Logger] in the file cat_logger.py, line 9

@evereux
Copy link
Owner

evereux commented Mar 11, 2024

Thanks for reporting this. I'll try and get this done this week.

@evereux
Copy link
Owner

evereux commented Mar 17, 2024

Closing as 0.6.7 now has these changes implemented.

@evereux evereux closed this as completed Mar 17, 2024
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