The problem here is that "sim_path" is not a canonical path name, so the assertion would fail if the path we're switching into contains a symbolic link. This problem affects all operating systems, it's not limited to macOS. But on macOS, the problem is especially serious, since macOS's "/tmp" is a link to "/private/tmp" by default. Thus, it causes an AssertionError in all the included Python examples.
Instead of doing assert os.getcwd() == sim_path, we should do assert os.getcwd() == os.path.realpath(sim_path) instead to ensure we're checking a canonical path in order to fix Issue #113.
Currently, running openEMS's example Python scripts on macOS always fails with the following error:
This is caused by an oversight of an assertion in openEMS.pyx:
The problem here is that "sim_path" is not a canonical path name, so the assertion would fail if the path we're switching into contains a symbolic link. This problem affects all operating systems, it's not limited to macOS. But on macOS, the problem is especially serious, since macOS's "/tmp" is a link to "/private/tmp" by default. Thus, it causes an AssertionError in all the included Python examples.
Instead of doing
assert os.getcwd() == sim_path
, we should doassert os.getcwd() == os.path.realpath(sim_path)
instead to ensure we're checking a canonical path in order to fix Issue #113.