Library's implementation file (HS_ or HSI) at line 1468 : error 1339: function 'NTRDirectUse_v1_Load_GUI' must return a value

I have a question regarding API extension.

When adding the required equipment function to STAR_OEM_Toolkit.smt and parameterizing it, I have encountered an issue where it does not require me to bind a return value. This leads to the following HSL syntax error:

Library's implementation file (HS_ or HSI) at line 1468 : error 1339: function 'NTRDirectUse_v1_Load_GUI' must return a value

How does one get around this? I am specifically looking at the load_GUI function of the NTRDirectUse_v1.0 library. I’ll attach some images for context.

I hope this makes sense, please let me know if you need more information!

Hi, that’s an interesting error which I’ve never seen before. Can you share the code referenced in the error, i.e. line 1468 in “Library’s implementation file”.

My best guess is that your sub-method function returns o_stepReturn, but this variable will not be created if you don’t enter error handling. Unfortunately this might require a hacky solution like explicitly assigning o_stepReturn = 0 after the main function finishes.

But, I disagree with the implementation of this library into PyHamilton in the first place. You should do what you want, but hear me out. This is a library that purely handles data. I strongly suspect that one could relatively easily implement a pure-Python implementation of this entire library. Once that exists you have infinite flexibility in extending or changing what the library provides to fit your own needs.

If you think you will benefit in the short-term from doing this in PyHamilton, then by all means go ahead, but I would be more than happy to write an equivalent library in pure Python if you are interested.

1 Like

Hello @oldwhpsian,

To answer your original question, if the Function (Submethod) is set to “Return value = Variable” as in your first screenshot, all code paths within that Submethod must have a “Return” step with a value or variable within each terminating branch.