Search code examples
pythonpython-3.xanacondalabview

Unable to apply method "read" to TdmsFile from nptdms


I have been using the nptdms module to do analysis of TDMS files without issue for several years. Recently, I got an error when trying to read a TDMS file for the first time. I import TdmsFile from nptdms:

from nptdms import TdmsFile

I try to read it:

tdms_file = TdmsFile.read(path_to_my_tdms_file)

and then get the following error:

type object 'TdmsFile' has no attribute 'read'

I am using python v3.6.10, with Anaconda and the nptdms v0.12.0.


Solution

  • The method you are referring to exists in the current documentation so it would make sense to

    1. Restart the virtual environment (close cmd line; start again; conda activate <name of your env>).

    If this does not help...

    1. Reinstall the package:

      conda remove nptdms

      conda install nptdms

    (the exact commands may differ depending on your environment).

    If this does not help, create a fresh conda environment and install from scratch and check again.