@acer Yes, I certainly could write a script file and then run that. That would be likely a two-stage approach: first write the script, then execute it. Quite possible assuming something like cat can be made to work (cat in the shell, that is). Writing a script and passing arguments is a bit more tricky as the argument maybe a whole routine. I was thinking of shortcutting the process by using the -c flag in python to just upload the script into the command line. The general idea is to submit a piece of code to a python script and read the result back in to Maple. And for python you can read python, perl, Ruby, what have you. I was even thinking about a Fortran program, but the overhead and vagaries of compiling and linking likely makes that approach impractical. All of this stuff is numerical, but Maple would generate the program, puts it into a string that goes into the ssystem() call.
Specifically for Python I need numpy and maybe scipy; right now I am not able to import these through ssystem(). I assume the reason is that the environment is not being setup.
I did not use absolute paths for .cshrc because ssystem("pwd") tells me that my home directory is the default for ssystem() calls. I'll try absolute paths. ssystem("printenv") tells me that ssystem() is running tcsh (which is my default shell), but clearly my .cshrc is not being run and any attempt to setenv something through ssystem() also fails (e.g. ssystem("setenv PATH /opt/local/bin:$PATH") fails). It is a bit difficult to trouble shoot all this as I cannot concatenate any shell commands (e.g. ssystem("cd work ; ls") does not work even though it works perfectly well in the interactive shell) so I cannot print the output, and ssystem() just returns an error code (usually 1) and an empty string.
Right now my tests use direct strings just the way I type them here. I did experiment with quoting e.g. the string in a composite statement (ssystem("'pwd ; ls'")) but to no avail. Interestingly enough composite statements do work when I send them to python using -c (e.g. ssystem("python -c A=2;print(A)") works (returns (0,"2"); ssystem("pwd ; ls") does not work (returns (1,"")) ).