question

CSN avatar image
0 Likes"
CSN asked CSN commented

FlexSim crashes when calling Python software

Hello everyone:

I encountered a problem, in the 2022.1 version, I simulated a very simple scenario of FlexSim calling Python. But strangely the model crashes, as shown in the GIF below: Is there any way to fix this situation? thanks.

flexsim-python.gif

FlexSim 22.1.0
python
flexsim-python.gif (4.5 MiB)
· 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @CSN, was Jordan Johnson's answer helpful? If so, please click the "Accept" button at the bottom of their answer. 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 unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered CSN commented

Here are my thoughts:

  1. It looks like you picked the beta version, in the gif you showed. Please be sure to pick the released version, 22.1.1 or later. It also may be that the gif skipped a frame when you picked the correct version.
  2. Verify that python is available on your PATH. To verify, open a command prompt and run this command:
    python --version
    When you run this command, the command prompt should report a python version, rather than an error message.
  3. If the previous step gave you a version number (for example, mine reports 3.9.9), then you need to make sure that FlexSim is trying to connect to that version. The easiest way to check is to go to the Code tab in Global Preferences, and check the version there. Since my python version is 3.9.9, I use the 3.9 option:1652888613950.png

Let me know if you still are having trouble. But these are a few good things to try first.


1652888613950.png (12.6 KiB)
· 3
5 |100000

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

CSN avatar image CSN commented ·

Thanks for your answer, I followed your prompt to set up and updated the software to 22.1.2. When I tested it again, The software did not prompt an error, it was forced to quit, just like the first GIF. Is there any other solution? thanks.cmd.pngflexsim.pngflexsim2.png

0 Likes 0 ·
cmd.png (57.4 KiB)
flexsim.png (596.1 KiB)
flexsim2.png (84.1 KiB)
Jordan Johnson avatar image Jordan Johnson ♦♦ CSN commented ·

One thing to verify is that python itself is 64 bit. If you just enter "python" in the command line, you'll some additional information about the version:

1653414791131.png

Please verify that your python in 64-bit.

Other than that, I'm not sure what the issue could be. Perhaps having multi-byte characters in your PATH is an issue?

You may be able to build your own version of the PyConnector. We supply the code in this repository:
https://github.com/flexsim/FlexSimPy

You may also be able to build that project, and then debug it, to see what is happening when FlexSim tries to access that dll.

0 Likes 0 ·
1653414791131.png (15.1 KiB)
CSN avatar image CSN Jordan Johnson ♦♦ commented ·

Thanks for your answer, I found the problem, it should be because my file path contains Chinese characters, thanks again.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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