Using objmode Invalid type annotation on non-outgoing variables:

@njit
def mader_numba():
    tolerance = 10 ** (-10)
    beta_tolerance = 0.0005
    
    data_file_path = 'C:/Users/luisu/Desktop/DM/MADHAT-master/MADHAT-master/Input/set1.dat'
    
    NOBS_data = "C:/Users/luisu/Desktop/DM/MADHAT-master/MADHAT-master/PMFdata/Fermi_Pass8R3_239557417_585481831/NOBS.dat"
    with objmode(data = 'float64[:,:]'):
        data = np.loadtxt(data_file_path)
    #print(data) ## this print statement works

    with objmode(NOBS = 'float64[:,:]'):
        NOBS = np.loadtxt(NOBS_data)
    print(NOBS) ## this is where I get the error, but the error references 'data'
    
#     ID = data[:,0].astype(int)
#     print(ID)
    return 0 

For some reason, I’m having issues opening files for later computation. I’ve opened files in Numba before with objmode, but it’s just not working.

    with objmode(data = 'float64[:,:]'):
        data = np.loadtxt(data_file_path)

This line works, but when I attempt to do the exact same thing with a different file, I get this error code

Failed in nopython mode pipeline (step: Handle with contexts)
Invalid type annotation on non-outgoing variables: {'data'}.Suggestion: remove annotation of the listed variables

I’m not sure why the NOBS data file is receiving an error, but the error code is referencing the variable 'data'

Does anyone know why this error comes up?

I figured out the issue. For some reason it does not like to have consecutive with objmode I had to add something to the code after the with statement and move on with the other