sms-tools icon indicating copy to clipboard operation
sms-tools copied to clipboard

poor portability of sys.path.append in assignment modules

Open beanbrainbb opened this issue 4 years ago • 3 comments

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.

beanbrainbb avatar May 29 '20 07:05 beanbrainbb

The correct approach would be to use pathlib

m3m0ry avatar Mar 20 '21 13:03 m3m0ry

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).

josiasmat avatar Apr 16 '23 21:04 josiasmat

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 😄

egndz avatar Jan 21 '24 17:01 egndz