greatspn / SOURCES

Main repository of the GreatSPN framework
GNU General Public License v2.0
42 stars 13 forks source link

DSPN-Tool fails when running it on CMD at Win10 #39

Closed f-rit closed 2 years ago

f-rit commented 2 years ago

Hi Guys, I installed the new Windows executable of GreatSPN. The GUI works pretty fine and I can sovle my PN. As I want to integrate the PN in a Python script, I'm calling it from command line. This results in an error (see below). AlphaFactory seems to be set for unix but called from DSPN-Tool on Windows. Commit 9047b67 fixes it for the GUI. It there an easy change for my usage?

Error:

AlphaFactory:  f_g(x)="I[22]"  rate=0.0102  acc=1e-08 tmpfname=/tmp/af_DdqsNGhe
exec: /usr/local/GreatSPN/bin/alphaFactory I[22] 0.010200000000000 0.000000010000000 /tmp/af_DdqsNGhe (pid=665184)
ERROR: posix_spawn[/usr/local/GreatSPN/bin/alphaFactory]: No such file or directory
Cannot communicate with alphaFactory.

ERROR: alphaFactory cannot be exec'd.

Error

Thanks

amparore commented 2 years ago

Yes, the Windows port is a bit fragile, as it has to keep a mixed Unix/Windows logic to operate. Unfortunately, it is not that easy to keep both the Windows & the Unix logics together. However, some code switches are just controlled by the presence of some environmental variables.

In particular, these two variables are relevant: GREATSPN_APPIMAGE_DIR should point to the GreatSPN binary directory, without the bin/ folder GREATSPN_TEMP_DIR any directory that will be used for temporary files

Currently, I cannot test the tool, as I am traveling and I don't have a Windows machine with me. Could you please check if these variables fixes the problem?

f-rit commented 2 years ago

Thanks for your fast reply.

Now the DSPN-Tool uses the Windows paths, but unfortunately it does not use it correct.

image

image

The correct folder should be: image But the ENV variables are not handled correct...

amparore commented 2 years ago

I suppose it is just the wrong path. Use C:\Program Files\GreatSPN\app\portable_greatspn Please also add a '\' at the end of the GREATSPN_TEMP_DIR pathname, as it is otherwise used incorrectly.

f-rit commented 2 years ago

Unfortunately, the change of the ENV variables does not affact the call. Also if I remove it, the error output is equal to my last post. It seems to be frozen.... Do you have any idea?

amparore commented 2 years ago

The error message in the terminal is:

ERROR: posix_spawn[C:\Program Files\GreatSPN\app\bin\alphaFactory.exe]: No such File

This is raised since the sub-tool is called with the code in https://github.com/greatspn/SOURCES/blob/09e8d331effe7296be5f2862ff3095e172967fbf/NSRC/numeric/numeric.cpp#L171

where appimg_dir is the value of the environmental variable GREATSPN_APPIMAGE_DIR it is not possible that by changing the variable value, the program behaviour remains unaffected. Have you set the variable as a global environment variable using the Windows Control Panel? In that case, have you restarted the CMD after changing the value? Please, check with echo %GREATSPN_APPIMAGE_DIR% that the value is properly set to the pathname up to the bin\ directory (excluded), so that the highlighted code builds the proper alphaFactory pathname.

f-rit commented 2 years ago

Thanks! Perfect, it works!

I missed the restart of CMD...

You can close the issue and thanks for the impressive support!