Help Troubleshooting RuntimeError with C3DFileAdapter in Python

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ali Forouzanfar
Posts: 27
Joined: Thu Dec 15, 2022 11:21 pm

Help Troubleshooting RuntimeError with C3DFileAdapter in Python

Post by Ali Forouzanfar » Fri Mar 15, 2024 9:50 am

Hello,
I'm working with OpenSim in Google Colab and encountering a "RuntimeError: Could not open the c3d file: iostream error" when trying to read a C3D file using the C3DFileAdapter. Here's my code, followed by the complete error message:

#@title Reading C3D files through Python
import os
import opensim
import opensim as osim
from opensim import C3DFileAdapter

file_path = os.path.join('/content/drive/MyDrive/ C3D Data', '0204A06.c3d')
tables = c3dFileAdapter.read(file_path)
markers = tables['markers']
forces = tables['forces']

Error Message:
RuntimeError Traceback (most recent call last)
<ipython-input-19-7ca2ba31e342> in <cell line: 8>()
6
7 file_path = os.path.join('/content/drive/MyDrive/ C3D Data', '020824A06.c3d')
----> 8 tables = c3dFileAdapter.read(file_path)
9 markers = tables['markers']
10 forces = tables['forces']

/usr/local/lib/python3.9/site-packages/opensim/common.py in read(self, dataSourceSpecification)
22454 def read(self, dataSourceSpecification):
22455 r""" Public interface to read data from a dataSourceSpecification, typically a file or folder"""
> 22456 return _common.DataAdapter_read(self, dataSourceSpecification)
22457
22458 def getDataTable(self, tables, tableName):

RuntimeError: std::exception in 'OpenSim::DataAdapter::OutputTables OpenSim::DataAdapter::read(std::string const &) const': Could not open the c3d file: iostream error

I appreciate any advice or insights you can provide.
Thank you!

Tags:


User avatar
Ali Forouzanfar
Posts: 27
Joined: Thu Dec 15, 2022 11:21 pm

Re: Help Troubleshooting RuntimeError with C3DFileAdapter in Python

Post by Ali Forouzanfar » Sat Mar 23, 2024 8:39 am

Thank you

POST REPLY