Errors When Using tdm_module in Python Scripts in DIAdem

Updated Jan 29, 2025

Reported In

Software

  • DIAdem

Programming Language

  • Python

Issue Details

I have successfully installed a Python module named tdm_loader, but when I attempt to use it in DIAdem, I receive the following error:

Errors When Using tdm_module in Python Scripts in DIAdem.png

Solution

The error occurs due to compatibility issues between the module and the installed Python version. Some parts of this module are only compatible with Python 3.9 and above, so in order to use the module, you will need to use Python version 3.9 or above. To solve the issue, follow the steps below:

Note: Before proceeding, ensure that the Python version you want to use is compatible with the DIAdem installed on your computer.

  1. Open the Command Prompt and run py -0 to check the installed Python versions. If Python 3.9 or above is not listed, proceed to install it.

03453591 Command prompt - 1.png

  1. Follow these steps to add the installed Python path:
    1. Open Settings.
    2. Go to System.
    3. Navigate to About and click on Advanced system settings.
    4. In the Advanced tab, click on Environment Variables.

Errors When Using tdm_module in Python Scripts in DIAdem - 3.png

    1. Under User variables, select Path and click Edit.

Errors When Using tdm_module in Python Scripts in DIAdem - 2.png

    1. Click New and enter C:\Users\<user>\AppData\Local\Programs\Python\<python version> and C:\Users\<user>\AppData\Local\Programs\Python\<python version>\Scripts. Move these paths to the top of the list.

Errors When Using tdm_module in Python Scripts in DIAdem - 1.png

  1. Restart the Command Prompt and run python --version to verify the default Python version.

03453591 Command prompt - 2.png

  1. Install tdm_loader. This module will be installed in the default Python version file path. Additionally, you may need to reinstall the PyWin32 module to use Python in DIAdem.
  2. Execute the following commands one by one to ensure tdm_loader can be used without issues:
    • cd c:\Windows\System32
    • python
    • import tdm_loader
    • help(tdm_loader)

03453591 Command prompt - 3.png

  1. If the commands execute without errors as above picture, open DIAdem and change the Python Installation Path in the DIAdem script settings to C:\Users\<user>\AppData\Local\Programs\Python\<python version>. This will change the default version of Python used by DIAdem.
  2. Then, run import tdm_loader in the Python script in DIAdem to verify that the module can be used correctly.