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.

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.