scale tool error OpenSim 4.5

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ekaterina Stansfield
Posts: 10
Joined: Mon Jul 03, 2017 5:37 am

scale tool error OpenSim 4.5

Post by Ekaterina Stansfield » Wed Dec 11, 2024 12:34 am

Hello, my system is Windows 11, OpenSim 4.5

I get the following error when trying to run the scaling tool in GUI:

java.lang.RuntimeException: SimTK Exception thrown at Xml.cpp:115:
Error detected by Simbody method Xml::writeToFile(): Failed to write to the Xml file 'C:\Users\ebuly\OneDrive\Documents\WORK\JRF_GaitAnalysis\020\P20\model_update\3a_osim_markers\3a_osim_markers\scaled_model_P20.osim' with error ' (line=1, col=1)'.
(Required condition 'saveOK' was not met.)

at org.opensim.modeling.opensimActuatorsAnalysesToolsJNI.OpenSimContext_processModelScale__SWIG_0(Native Method)
at org.opensim.modeling.OpenSimContext.processModelScale(OpenSimContext.java:329)
at org.opensim.tracking.ScaleToolModel$ScaleToolWorker.construct(ScaleToolModel.java:341)
at org.opensim.swingui.SwingWorker$2.run(SwingWorker.java:130)
[catch] at java.lang.Thread.run(Thread.java:750)

How do I fi it?
Thank you.

Tags:

User avatar
John Davis
Posts: 60
Joined: Mon Aug 26, 2019 7:42 am

Re: scale tool error OpenSim 4.5

Post by John Davis » Wed Dec 11, 2024 11:28 pm

Usually that error is caused by having the file you're trying to write to open in, or accessed by, another program. For example, if you have that .osim file open in a text editor because you're editing it, that will cause this error. Ditto for .sto files in Excel.

More rarely, sometimes there are "old" processes that didn't get terminated correctly that are still trying to access the file. You can try closing OpenSim, and any software bound to it (e.g. MATLAB or Python), then using control-alt-delete to make sure opensim.exe, matlab.exe, and python.exe are not running. Then restart opensim and try again. Make sure you didn't have any parallel processes running in parfor loops if you're using MATLAB (not like you'd use that for scaling, but parallel processes have stuck around for me after using inverse dynamics or static optimization).

Lastly, I have also run into this problem once in a while when the file is being synced by services like Google Drive, OneDrive, iCloud, or Dropbox. The root cause is the same: some other process is trying to access the file, and OpenSim can't overwrite it. In this case, close out of your cloud service and try again, or just reboot your computer and try again.

Another easy fix is just changing the name of the output file to something new, so there's no old file to overwrite.

POST REPLY