question

Hemanth Sai Kumar avatar image
0 Likes"
Hemanth Sai Kumar asked Logan Gold commented

Code Binding Error

Hi Folks,

I am trying to link external python 3.11 with FlexSim 2024 here I am trying a small example case where I need to assign a cycle time of a processor externally ,when I am trying it I am getting an error as below,

Error:
exception: Code Binding Error: could not bind to function

Node: /Processor1>variables/cycletime

Binding string: item.id = add_num(5, 10)

/**external python: */ /**/"my_1st_code_1"/**/

/** \nfunction name:*/ /**/"add_num(5, 10)"/**/


Windows Error Code : 126


Below I am attaching the ss and kindly can anyone guide me in fixing the error. Thanks in advance !

use-case.png


cycle-time-code.png
error-message.png

FlexSim 24.1.0
procesorflexsim pythonconnect to external code
use-case.png (200.8 KiB)
cycle-time-code.png (11.8 KiB)
error-message.png (88.4 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Hemanth Sai Kumar,

Were you able to solve your problem? If so, please add and accept an answer to let others know the solution. Or please respond to the previous comment so that we can continue to help you.

If we don't hear back in the next 3 business days, we'll assume you were able to solve your problem and we'll close this case in our tracker. You can always comment back at any time to reopen your question, or you can contact your local FlexSim distributor for phone or email help.

0 Likes 0 ·
Logan Gold avatar image Logan Gold ♦♦ commented ·

Hi @Hemanth Sai Kumar, was one of Arun's or Felix Möhlmann's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·
Arun avatar image
0 Likes"
Arun answered

Hi Hemanth,

Firstly, the anaconda is not working in Flexsim to my knowledge. so make sure you install Python from here. Further on u need to check on pyhton version in flexsim code
1717313042170.png
Lastly and more importantly, you must add the path to environmental variables as mentioned here.
This should solve the Python integration issue.


1717313042170.png (32.3 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

From what I've seen so far, error code 126 means that your python installation needs to be added to the PATH. See linked post below.

https://answers.flexsim.com/questions/140337/python-function-error-windows-error-code-126.html

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.