yeah, essentially from what I understand it doesn't allow you to run package commands, just system commands.
I use the free BBox plugin to run Python scripts (more often for PHP in my case) from within FileMaker:
Unfortunately, BBox runs only on OS X.
Can't even run a shellscript from BE_, which would then do the job. Mh...
1 of 1 people found this helpful
I've not run Python scripts but I have run Ruby. Presumably the issues will be similar. This was a couple of years ago so i don't have the example handy.
What i found was that I had to specify the full path to everything. My initial efforts didn't work because while i specified the full path to the ruby code, i also had to specify which version of ruby i was running.
this thread was very useful : Can't execute more than one command with ExecuteSystemCommand · Issue #102 · GoyaPtyLtd/BaseElements-Plugin · GitHub
You can use Send Event with cmd and execute AppleScript with bash. It is going to be easier to ran external scripts this way. The issue is getting the results back to FileMaker.
I tend to output results into a text file and load it back to FIleMaker on the next script step. You can also put results into pasteboard, but then you are in danger of overwriting user pasteboard. Loading into a webviewer is another option
3 of 3 people found this helpful
A problem you might meet using the plug-in function is, it needs the output encoding as UTF-8.
When I use it on Windows,
BE_ExecuteSystemCommand("cmd /c dir /b c:\\")
can return results since the output contains only ASCII characters (subset of UTF-8), but
BE_ExecuteSystemCommand("cmd /c dir c:\\")
results "?" since the output contains Japanese characters in code page 932 (not UTF-8).
That was helpful indeed. At least now i can check if pip is installed and also for certain pip packages.
Still, executing python directly from within the command, like
BE_ExecuteSystemCommand ( " /usr/bin/python -V"; -1)
or even short scripts won't work.
Have to look into the UTF-8 issue, though.
The issues is probably due to shell scripts. The BE function uses the sh shell, so isn't the same as bash which is the OS X default for users. So to run inside bash you need to do :
BE_ExecuteSystemCommand ( "/bin/bash -c \"commandhere\"" )
thanks, but this was one of the first things I tried to exclude. Also, I changed my terminal to start sh as standard and tested every command there.
Running this command in the plugin doesn't work because the results aren't being passed to stdout where the plugin can get them. There's some sort of screen buffer going on, which would require special plugin code to capture.
The solution would be to send the output to a text file instead, and then read that in afterwards, but that gets beyond my unix chops
2 of 2 people found this helpful
Ah, redirect stderr to stdout
BE_ExecuteSystemCommand ( "python -V 2>&1" )