Skip to content

[BUG] config fails when root_data is not defined #397

@ElineOppersma

Description

@ElineOppersma

✨ Feature Description

The config fails on Mac OSx system

📈 Motivation

To enable Apple users to use resurfemg efficiently

🧩 Proposed Solution

Fix bug

🔍 Alternatives Considered

n/a

📚 Additional Context

see error log below

✅ Checklist

  • I’ve checked that this feature isn’t already requested or implemented
  • I’ve read the contributing guidelines
  • I’m willing to help implement this feature if needed

Error log:

AttributeError Traceback (most recent call last)
Cell In[2], line 4
1 # Identify all recordings available for the selected patient/measurement_date
2
3 # First find the patients
----> 4 config = Config()
6 # Then find the files for the selected patients:
7 base_path = config.get_directory('_data')

File /./.venv_py314/lib/python3.14/site-packages/resurfemg/data_connector/config.py:119, in Config.init(self, location, verbose, force)
105 self.default_locations = (
106 './config.json',
107 os.path.expanduser('
/.resurfemg/config.json'),
108 '/etc/resurfemg/config.json',
109 os.path.join(self.repo_root, 'config.json'),
110 )
111 self.default_layout = {
112 'root_data': '{}/not_pushed',
113 'test_data': test_data_path,
(...) 117 'output_data': '{}/output',
118 }
--> 119 self.load(location, verbose=verbose)
120 self.validate()

File ~/./.venv_py314/lib/python3.14/site-packages/resurfemg/data_connector/config.py:226, in Config.load(self, location, verbose)
224 if isinstance(root, str) and root.startswith('.'):
225 root = root.replace('.', config_path, 1)
--> 226 root = convert_to_os_path(root)
227 self._loaded['root_data'] = root
228 if root is None:

File ~/./.venv_py314/lib/python3.14/site-packages/resurfemg/data_connector/config.py:29, in convert_to_os_path(path)
20 def convert_to_os_path(
21 path: str,
22 ):
23 """
24 This function converts a path to a os readable path.
25 -----------------------------------------------------------------------
26 :param path: The path to convert.
27 :type path: str
28 """
---> 29 readable_path = path.replace(
30 os.sep if os.altsep is None else os.altsep, os.sep)
31 return readable_path

AttributeError: 'NoneType' object has no attribute 'replace'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions