You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem
I'm trying to read a dicom-file, which is in JPEG Lossless syntax. Therefor I need the pylibjpeg-libjpeg module, which causes an error in the import from pydicom:
AttributeError: partially initialized module 'pydicom' has no attribute 'config' (most likely due to a circular import)
Full traceback: Traceback (most recent call last): File "read_and_show_dicom.py", line 6, in <module> import pydicom File "C:\...\env38\lib\site-packages\pydicom\__init__.py", line 32, in <module> from pydicom.dataelem import DataElement File "C:\...\env38\lib\site-packages\pydicom\dataelem.py", line 18, in <module> from pydicom import config # don't import datetime_conversion directly File "C:\...\env38\lib\site-packages\pydicom\config.py", line 238, in <module> import pydicom.pixel_data_handlers.pylibjpeg_handler as pylibjpeg_handler # noqa File "C:\...\env38\lib\site-packages\pydicom\pixel_data_handlers\pylibjpeg_handler.py", line 59, in <module> import pylibjpeg File "C:\...\env38\lib\site-packages\pylibjpeg\__init__.py", line 38, in <module> add_handler() File "C:\...\env38\lib\site-packages\pylibjpeg\utils.py", line 24, in add_handler if handler not in pydicom.config.pixel_data_handlers: AttributeError: partially initialized module 'pydicom' has no attribute 'config' (most likely due to a circular import)
My environment
Output for: python -m pydicom.env_info
module
version
platform
Windows-10-10.0.19041-SP0
Python
3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:43:54) [MSC v.1928 32 bit (Intel)]
pydicom
2.1.2
gdcm
module not found
jpeg_ls
module not found
numpy
1.19.5
PIL
8.1.0
My imports
from tkinter import *
from tkinter.ttk import *
import cv2
import numpy as np
import pydicom
from PIL import ImageTk, Image
The text was updated successfully, but these errors were encountered:
Below, just simplifying the trace a little bit to make it easier to follow:
File "read_and_show_dicom.py",
import pydicom
File "...\pydicom\__init__.py", line 32,
from pydicom.dataelem import DataElement
File "...\pydicom\dataelem.py", line 18, in <module>
from pydicom import config
File "...\pydicom\config.py", line 238, in <module>
import pydicom.pixel_data_handlers.pylibjpeg_handler as pylibjpeg_handler
File "...\pydicom\pixel_data_handlers\pylibjpeg_handler.py", line 59, in <module>
import pylibjpeg
File "...\pylibjpeg\__init__.py", line 38, in <module>
add_handler()
File "...\pylibjpeg\utils.py", line 24, in add_handler
if handler not in pydicom.config.pixel_data_handlers:
AttributeError: partially initialized module 'pydicom' has no attribute 'config' (most likely due to a circular import)
I'm wondering whether this would be okay if you imported pylibjpeg first before pydicom in the user code? However, pylibjpeg examples show importing pydicom first. Maybe @scaramallion can comment.
The problem
I'm trying to read a dicom-file, which is in JPEG Lossless syntax. Therefor I need the pylibjpeg-libjpeg module, which causes an error in the import from pydicom:
AttributeError: partially initialized module 'pydicom' has no attribute 'config' (most likely due to a circular import)
Full traceback:
Traceback (most recent call last): File "read_and_show_dicom.py", line 6, in <module> import pydicom File "C:\...\env38\lib\site-packages\pydicom\__init__.py", line 32, in <module> from pydicom.dataelem import DataElement File "C:\...\env38\lib\site-packages\pydicom\dataelem.py", line 18, in <module> from pydicom import config # don't import datetime_conversion directly File "C:\...\env38\lib\site-packages\pydicom\config.py", line 238, in <module> import pydicom.pixel_data_handlers.pylibjpeg_handler as pylibjpeg_handler # noqa File "C:\...\env38\lib\site-packages\pydicom\pixel_data_handlers\pylibjpeg_handler.py", line 59, in <module> import pylibjpeg File "C:\...\env38\lib\site-packages\pylibjpeg\__init__.py", line 38, in <module> add_handler() File "C:\...\env38\lib\site-packages\pylibjpeg\utils.py", line 24, in add_handler if handler not in pydicom.config.pixel_data_handlers: AttributeError: partially initialized module 'pydicom' has no attribute 'config' (most likely due to a circular import)
My environment
Output for:
python -m pydicom.env_info
My imports
The text was updated successfully, but these errors were encountered: