diff --git a/examples/test_execute_command.py b/examples/test_execute_command.py new file mode 100644 index 00000000..0f029e1e --- /dev/null +++ b/examples/test_execute_command.py @@ -0,0 +1,17 @@ +from pyneuroml import pynml + +run_dir = '.' + +commands = ['pwd', 'ls -alt testss'] + +for command in commands: + + print("\n====================\n") + + returncode, output = pynml.execute_command_in_dir(command, run_dir, prefix="Output [%s] > "%command, verbose=True) + + print(' ---- Return code from execute_command_in_dir: %s; output: \n%s\n--------------------------'%(returncode, output)) + + success = pynml.execute_command_in_dir_with_realtime_output(command, run_dir, prefix="Output [%s]: "%command, verbose=False) + + print(' ---- Success of execute_command_in_dir_with_realtime_output: %s'%success) \ No newline at end of file diff --git a/pyneuroml/__init__.py b/pyneuroml/__init__.py index 44570f54..5b7b9e1d 100644 --- a/pyneuroml/__init__.py +++ b/pyneuroml/__init__.py @@ -12,7 +12,7 @@ __version__ = importlib_metadata.version("pyNeuroML") -JNEUROML_VERSION = "0.13.3" +JNEUROML_VERSION = "0.14.0" logger = logging.getLogger(__name__) logger.propagate = False diff --git a/pyneuroml/lib/jNeuroML-0.13.3-jar-with-dependencies.jar b/pyneuroml/lib/jNeuroML-0.14.0-jar-with-dependencies.jar similarity index 94% rename from pyneuroml/lib/jNeuroML-0.13.3-jar-with-dependencies.jar rename to pyneuroml/lib/jNeuroML-0.14.0-jar-with-dependencies.jar index 3c30dbb5..7b57492f 100644 Binary files a/pyneuroml/lib/jNeuroML-0.13.3-jar-with-dependencies.jar and b/pyneuroml/lib/jNeuroML-0.14.0-jar-with-dependencies.jar differ diff --git a/pyneuroml/runners.py b/pyneuroml/runners.py index 448c2a8c..a56a37a3 100644 --- a/pyneuroml/runners.py +++ b/pyneuroml/runners.py @@ -902,7 +902,7 @@ def execute_command_in_dir_with_realtime_output( ) with p.stdout: for line in iter(p.stdout.readline, ""): - print("# %s" % line.strip()) + print(" %s %s" % (prefix,line.strip())) p.wait() # wait for the subprocess to exit print("####################################################################") @@ -920,7 +920,7 @@ def execute_command_in_dir_with_realtime_output( if not p.returncode == 0: logger.critical( - "*** Problem running command (return code: %s): \n %s" + "*** Problem running command (return code: %s): [%s]" % (p.returncode, command) ) @@ -990,10 +990,13 @@ def execute_command_in_dir( return return_string.decode("utf-8") except subprocess.CalledProcessError as e: - logger.critical("*** Problem running command: \n %s" % e) - logger.critical( + logger.critical("*** Problem running last command: %s" % e) + + print("####################################################################") + print( "%s%s" % (prefix, e.output.decode().replace("\n", "\n" + prefix)) ) + print("####################################################################") return (e.returncode, e.output.decode()) except Exception as e: logger.critical("*** Unknown problem running command: %s" % e) diff --git a/setup.cfg b/setup.cfg index 6ea1b06e..84937bab 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pyNeuroML -version = 1.3.14 +version = 1.3.15 author = Padraig Gleeson author_email = p.gleeson@gmail.com url = https://github.com/NeuroML/pyNeuroML