Python script importations :
orthanc plugin version (debian-bookworm-python-3.11)
python version 3.11
import orthanc
import sys
import base64
import uuid
import json
import io
import subprocess
import os
import json
from datetime import datetime
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.backends import default_backend
from dateutil.parser import isoparse
import websockets
import requests
import pydicom
import asyncio
sys.path = [“/myenv/lib/python3.11/site-packages”,“/myenv/lib64/python3.11/site-packages”]
import pytz
Error when execute a function that requires a package :
pacs-1 | E0923 14:16:00.490657 74d370b616c0 PluginsManager.cpp:154] Error in the Python on-change callback, traceback:
pacs-1 | <class ‘ModuleNotFoundError’>
pacs-1 | No module named ‘dataclasses’
pacs-1 |
pacs-1 | File “/root/./config.py”, line 90, in OnChange
pacs-1 | asyncio.run(main({“id”:respData[‘updated’][‘id’],“studyUID”:targetStudy.get(‘MainDicomTags’)[‘StudyInstanceUID’],“examStatus”:“endExam”}))
pacs-1 |
pacs-1 | File “/usr/lib/python3.11/asyncio/runners.py”, line 190, in run
pacs-1 | return runner.run(main)
pacs-1 | ^^^^^^^^^^^^^^^^
pacs-1 |
pacs-1 | File “/usr/lib/python3.11/asyncio/runners.py”, line 118, in run
pacs-1 | return self._loop.run_until_complete(task)
pacs-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pacs-1 |
pacs-1 | File “/usr/lib/python3.11/asyncio/base_events.py”, line 653, in run_until_complete
pacs-1 | return future.result()
pacs-1 | ^^^^^^^^^^^^^^^
pacs-1 |
pacs-1 | File “/root/./config.py”, line 33, in main
pacs-1 | async with websockets.connect(json.loads(orthanc.GetConfiguration()).get(‘collabserver’)) as ws: # change host with container name
pacs-1 | ^^^^^^^^^^^^^^^^^^
pacs-1 |
pacs-1 | File “/usr/lib/python3/dist-packages/websockets/imports.py”, line 77, in getattr
pacs-1 | return import_name(name, source, namespace)
pacs-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pacs-1 |
pacs-1 | File “/usr/lib/python3/dist-packages/websockets/imports.py”, line 27, in import_name
pacs-1 | module = import(source[level:], namespace, None, [name], level)
pacs-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pacs-1 |
pacs-1 | File “”, line 1178, in _find_and_load
pacs-1 |
pacs-1 | File “”, line 1149, in _find_and_load_unlocked
pacs-1 |
pacs-1 | File “”, line 690, in _load_unlocked
pacs-1 |
pacs-1 | File “”, line 940, in exec_module
pacs-1 |
pacs-1 | File “”, line 241, in _call_with_frames_removed
pacs-1 |
pacs-1 | File “/usr/lib/python3/dist-packages/websockets/legacy/client.py”, line 24, in
pacs-1 | from …exceptions import (
pacs-1 |
pacs-1 | File “”, line 1178, in _find_and_load
pacs-1 |
pacs-1 | File “”, line 1149, in _find_and_load_unlocked
pacs-1 |
pacs-1 | File “”, line 690, in _load_unlocked
pacs-1 |
pacs-1 | File “”, line 940, in exec_module
pacs-1 |
pacs-1 | File “”, line 241, in _call_with_frames_removed
pacs-1 |
pacs-1 | File “/usr/lib/python3/dist-packages/websockets/exceptions.py”, line 36, in
pacs-1 | from . import datastructures, frames, http11
pacs-1 |
pacs-1 | File “”, line 1234, in _handle_fromlist
pacs-1 |
pacs-1 | File “”, line 241, in _call_with_frames_removed
pacs-1 |
pacs-1 | File “”, line 1178, in _find_and_load
pacs-1 |
pacs-1 | File “”, line 1149, in _find_and_load_unlocked
pacs-1 |
pacs-1 | File “”, line 690, in _load_unlocked
pacs-1 |
pacs-1 | File “”, line 940, in exec_module
pacs-1 |
pacs-1 | File “”, line 241, in _call_with_frames_removed
pacs-1 |
pacs-1 | File “/usr/lib/python3/dist-packages/websockets/frames.py”, line 3, in
pacs-1 | import dataclasses
pacs-1 |
pacs-1 | File “”, line 1178, in _find_and_load
pacs-1 |
pacs-1 | File “”, line 1142, in _find_and_load_unlocked
Some packages were declared as missing , what is wrong ?