python-saleae icon indicating copy to clipboard operation
python-saleae copied to clipboard

Path manipulation doesn't work when Logic is running on different OS than the Python module

Open mitbrooks opened this issue 5 years ago • 1 comments

Logic analyser running on a windows machine, From a linux machine:

import saleae
la = saleae.Saleae("hostname")
la.save_to_file('c:/test_file.logicdata')
la.load_from_file('c:/test_file.logicdata')

doesn't work. The same does work on a windows machine. I believe this is because in linux, os.path.abspath('c:/test_file.logicdata') returns /current/linux/working/directory/C:/test_file.logicdata

Would using os.path.normpath() work better here?

mitbrooks avatar Jul 09 '20 14:07 mitbrooks

Not quite like that unfortunately. normpath alone is insufficient, it would need to be basically what's suggested in the python docs of normpath(join(os.getcwd(), path)).

The deeper problem here is that Logic doesn't support relative paths, so we have to convert to an absolute path. The rules for path manipulation will come from the os module where the Python script is running. If Logic is running on a different operating system, this module would have to be told that somehow (I don't believe there is a is an absolute path on any operating system function we can call).

ppannuto avatar Jul 10 '20 14:07 ppannuto