DICOMProcesses.py error

Operating system:Windows11
Slicer version:5.6
Expected behavior: run a python script using 3D slicer
Actual behavior: the 3D slicer source code give me a error

I run a python script that creates a valid dataset from the source data found on TCIA using 3D Slicer. VS_Seg/preprocessing/data_conversion.py at master · KCL-BMEIS/VS_Seg · GitHub
but raise an error:
AttributeError: module ‘qt’ has no attribute ‘QProcess’

in Slicer_5.6.2\lib\Slicer-5.6\qt-scripted-modules\DICOMLib\DICOMProcesses.py

Please provide the exact steps that lead to the issue you are having. Ideally, describe how to reproduce the issue with publicly available data.

Firstly, I open the python script as a Pycharm Project, and I change the Python Interpreter (System Interpreter) to the D:/Slicer5.6.2/bin/PythonSlicer.exe, the path in 3D Slicer archive.
Secondly, I run the python script aforementioned.
Then, I encounter the error

"D:\Slicer 5.6.2\bin\PythonSlicer.exe" D:\Dataset_preprocess\TCIA_VS_SEG\data_conversion.py -i D:/Dataset/VS_SEG/ -o D:/Dataset/VS_SEG1/ 
No module named 'logic'
Traceback (most recent call last):
  File "D:\Dataset_preprocess\TCIA_VS_SEG\data_conversion.py", line 48, in <module>
    from DICOMLib import DICOMUtils
  File "D:\Slicer 5.6.2\lib\Slicer-5.6\qt-scripted-modules\DICOMLib\__init__.py", line 1, in <module>
    from .DICOMProcesses import *
  File "D:\Slicer 5.6.2\lib\Slicer-5.6\qt-scripted-modules\DICOMLib\DICOMProcesses.py", line 38, in <module>
    class DICOMProcess:
  File "D:\Slicer 5.6.2\lib\Slicer-5.6\qt-scripted-modules\DICOMLib\DICOMProcesses.py", line 84, in DICOMProcess
    def start(self, cmd: str, args: list[str]) -> qt.QProcess:
AttributeError: module 'qt' has no attribute 'QProcess'

Process finished with exit code 1

I use the public dataset from TCIA. The raw data includes
every patient’s T1 and T2 DICOM files,
RT_Structure.dcm RT_Dose.dcm RT_Plan.dcm and metadata.csv
and tumor segmentation label contour.json
and T1toT2 and T2toT1 registration matrices inv_T1_LPS_to_T2_LPS.tfm or inv_T2_LPS_to_T1_LPS.tfm
In proprecessing raw data, Firstly, TCIA_data_convert_into_convenient_folder_structure.py makes the raw data to a convenient folder structure which puts the every patient’s T1 folder and T2 folder
Secondly, data_conversion.py converts the DICOM images and contour.json to NIFTI using the 3D Slicer. The error happens in this step.

PythonSlicer doesn’t have the application context needed to run all the DICOM options. See the warning here:

https://slicer.readthedocs.io/en/latest/developer_guide/python_faq.html#what-is-the-pythonslicer-executable

You probably can just run the regular Slicer application instead.

Thanks a lot!! I run the data_conversion.py in the Python Console 3D Slicer application. It works!! Thanks again.