Search code examples
pythonjython-2.7pydicom

How to use pydicom in jython


When I tried to import dicom in pydicom package I got error. I performed the following steps. Downloaded the pydicom-0.9.9.tar file,extracted and performed 'jython setup.py install' in cmd.But its not working. Is this due to compatability of jython with python? How to make pydicom is working in jython?


Solution

  • There is a bug in Jython on the bytecode files size. That is, Jython can’t compile the file if a module have huge bytecode size and unfortunately PyDicom have 2 such files. So, The work around is to split the files into junks and try installing.

    This is a temporary work around and this issue has been resolved in Jython2.7.1 version. For now, try the following

    • Split the “pydicom-0.9.8\dicom_dicom_dict.py” file into multiple files(4) files with 700 entries in a list.

    • Split the “pydicom-0.9.8\dicom_private_dict.py” files into multiple files with 700 entries in each

    • Search and change the usage of _dicom_dict.py contents in the pydicom package

      example: go to datadict.py and edit the following

      from dicom._dicom_dict_1 import DicomDictionaryOne from dicom._dicom_dict_2 import DicomDictionaryTwo from dicom._dicom_dict_3 import DicomDictionaryThree from dicom._dicom_dict_4 import DicomDictionaryFour DicomDictionary.update(DicomDictionaryOne) DicomDictionary.update(DicomDictionaryTwo) DicomDictionary.update(DicomDictionaryThree) DicomDictionary.update(DicomDictionaryFour)

    • Search and change the usage of _private_dict.py contents in the pydicom package Install the package using setup.py