jrkerns / pylinac

An image analysis library for medical physics
https://pylinac.readthedocs.io/en/latest/
MIT License
157 stars 99 forks source link

Can not import CatPhanBase #443

Closed arai0101 closed 1 year ago

arai0101 commented 1 year ago

Can not import CatPhanBase When I try to import CatPhan, there is an error:

Traceback (most recent call last): File "linac.py", line 3, in from pylinac import CatPhan504 File "D:\pylinac_train\venv\lib\site-packages\pylinac__init__.py", line 12, in from .acr import ACRCT, ACRMRILarge File "D:\pylinac_train\venv\lib\site-packages\pylinac\acr.py", line 21, in from .ct import CatPhanBase, CatPhanModule, Slice, ThicknessROI, get_regions File "D:\pylinac_train\venv\lib\site-packages\pylinac\ct.py", line 1471, in class CatPhanBase: File "D:\pylinac_train\venv\lib\site-packages\pylinac\ct.py", line 2048, in CatPhanBase def results(self, as_list: bool = False) -> Union[str, list[list[str]]]: TypeError: 'type' object is not subscriptable

I am using python 3.8, pylinac 3.10.0, with virtualenv. Thank you in advance

jrkerns commented 1 year ago

Ah, sorry about that. That's a python type thing. The quickest fix is to go to the ct.py file and add from __future__ import annotations to the very first line of the file and that should fix it.

jrkerns commented 1 year ago

Fixed in 3.11.