sms-tools
sms-tools copied to clipboard
poor portability of sys.path.append in assignment modules
Just starting the course, here. I found that the sys.path.append calls in the assignment modules fail silently. A quick stack overflow search returned this
consider using sys.path.dirname instead?
I'd refactor this and submit a pull request but I'm so tired, I don't even know what day it is now.
The correct approach would be to use pathlib
I replaced sys.path.append('../../software/models')
by sys.path.append(os.path.join('..','..','software','models'))
.
pathlib is new to Python 3.4, so users of older Python versions would not be able to use it (although Python 3.4 is not new anymore by any measure).
Instead of adding the libraries using sys.path
, how about creating a package with setup.py(deprecated tho) or pyproject.toml file for software
and importing them e.g. from software.modules import harmonicModel as HM
.
I am new to the repo, it is a suggestion and happy to discuss them in detail 😄