question

Guillem F avatar image
0 Likes"
Guillem F asked Guillem F commented

v22.1 "Code Binding Error: could not bind to function"

I'm trying to test the new python external code functionality (release 22.1) through alan.zhang's example on 'Future Python and FlexSim integration':

pymod.py

python-test.fsm

The following error pops:

  1. exception: Code Binding Error: could not bind to function
  2. Node: /Tools/UserCommands/python_test/code
  3. Binding string: external python "pymod" "PyFunc"
  4. Windows Error Code : 126

A similar error was discussed in 'Cannot bind to Python function', but quite not the same, as I'm saving both the flexsim and the python docs in the same folder.

I'm not sure if the python environment matters (currently using Spyder), but at this point I could blame it on anything, since I tried many things but the error persists.

I appreciate any attention, thanks in advance.

FlexSim 22.1.0
python
pymod.py (34 B)
python-test.fsm (28.2 KiB)
· 1
5 |100000

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

1 Answer

Phil BoBo avatar image
1 Like"
Phil BoBo answered Guillem F commented

The model and python script are fine.

Make sure you have installed and configured python correctly on your system.

Python's location should be in your PATH environment variable, and the correct version number of that Python install should be specified in the Code tab of your Global Preferences in FlexSim:

1650471072768.png



1650471072768.png (178.8 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.