Permission error for Bruker files and not recognizing tnt files

Skip to first unread message

Grigore Alexandra

Jun 9, 2017, 11:07:54 AM6/9/17
to nmrglue-discuss

I just discovered nmrglue and got really excited as getting data manually from TopSpin and TNMR has been my constant nightmare. 

I managed to install all the libraries and run some example scrips, however I am getting some errors for both Bruker and TecMag files. Any help would be appreciated!

1. Bruker - I used the example here and I am getting this error:
...line 1596, in get_fdata
    fdata = np.fromfile(filename, 'float32', 512)
PermissionError: [Errno 13] Permission denied: 'expnmr_00001_1'
- I followed the exact instructions, unpacked the tar and placed it in the same directory as my script. It seems to be related to the fact that the read function needs a file, not a folder. Any quick fix for this? I tried putting the fid file instead, but didn't work.

2. TecMag - I used this reading example and I'm getting this error:
...\", line 254, in read
    with open(filename, 'rb') as tntfile:
FileNotFoundError: [Errno 2] No such file or directory: '13C_EtOH_1pulse'
- it doesn't seem to recognize the file as a tnt file, although it definitely is. I tried with multiple files, including the test example ones that TNMR comes with. Are there different versions that this script doesn't work with?

Thank you very much!


Jonathan Helmus

Jun 13, 2017, 10:27:18 AM6/13/17

    Can you provide some more details on what version of nmrglue you installed and what is triggering the errors you are seeing.  I've tried to reproduce the error you are seeing.

When reading the expnmr_00001_1 Bruker file you linked, you need to use the nmrglue bruker read function.  The following snippet works fine on my machine:

import nmrglue as ng
dic, data ='expnmr_00001_1')

If I instead use:

dic, data ='expnmr_00001_1')

I get a similar error to what you reported.  Since the files in question are in Bruker format not NMRPipe the function should not be used to read this data.

The error you are seeing when reading the TecMag file indicates that the file does not exist in the path that was given.  Can you verify that the "13C_EtOH_1pulse" file exists.  Typically Tecmag files has a .tnt file extension, this extension should be included in the filename provided to the function.  For example to read a Tecmag file named LiCl_ref1.tnt, use the following:

import nmrglue as ng
dic, data ='LiCl_ref1.tnt')


    - Jonathan Helmus
You received this message because you are subscribed to the Google Groups "nmrglue-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Alexandra Grigore

Jun 16, 2017, 1:50:23 PM6/16/17
to nmrglue-discuss
Hi Jonathan,

Thank you very much for your reply!

I have nmrglue-0.5, I just saw the 0.6 version, might upgrade to that.

Regarding the Bruker file issue, I used, I basically copied the example in the documentation - and I get the float error. See below the full error message:

Traceback (most recent call last):
  File "C:/Users/nemes/Google Drive/PhD/Python scripts/GettingNMRdata/", line 5, in <module>
    dic, data ='expnmr_00001_1')
  File "C:\Users\nemes\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nmrglue\fileio\", line 327, in read
    null, data = read_binary(f, shape=shape, cplex=cplex, big=big)
  File "C:\Users\nemes\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nmrglue\fileio\", line 996, in read_binary
    return dic, data.reshape(shape)
TypeError: 'float' object cannot be interpreted as an integer

I used both the expnmr_00001_1 folder that was given in the example as well as my own data and I always get the same error. Googling the error suggests something about file vs folder issue?!

The Tecmag issue was solved, thank you! The file was indeed a .tnt one, but when I was using .tnt  extension in the file name, I also added it in the file name on my computer and it didn't work (as I tried both with or without extension before). So basically the only way it works is if the file doesn't have any extension in the name itself, but the extension is written in the python script. Now I just need to figure it out how to plot it :)

Thanks again!

Jonathan Helmus

Jun 16, 2017, 2:43:50 PM6/16/17
The TypeError is a result of an bug in nmrglue that was fixed last year [1].  Updating to version 0.6 should address the issue.  Alternatively downgrading to NumPy 1.11 or before will also address the issue.


    - Jonathan Helmus


Alexandra Grigore

Jun 18, 2017, 5:31:35 PM6/18/17
to nmrglue-discuss
Perfect, 0.6 solved the problem!

Thanks a lot!
Reply all
Reply to author
0 new messages