diff --git a/python/README.md b/python/README.md index 51a178a..5130bdd 100644 --- a/python/README.md +++ b/python/README.md @@ -26,25 +26,3 @@ This needs Python 3.12.x. After installation, you can use the `wypp` command for running your python files, making all features explained below available. Run `wypp --help` for usage information. -## Development - -### Debugging - -To debug a failing unit test, insert the following at top of the file (adjust path as needed): - -``` -import sys -sys.path.insert(0, '/Users/swehr/devel/write-your-python-program/python/deps/untypy') -``` - -Then insert at the end of the file: - -``` -def _debug(): - t = TestSimple() - t.setUp() - t.test_wrap_inheritance() -_debug() -``` - -Then debug in vscode diff --git a/python/code/wypp/runYourProgram.py b/python/code/wypp/runYourProgram.py index 702b1d8..02af2c5 100644 --- a/python/code/wypp/runYourProgram.py +++ b/python/code/wypp/runYourProgram.py @@ -13,5 +13,10 @@ sys.exit(1) if __name__ == '__main__': + import os + sourceDir = os.path.normpath(os.path.dirname(__file__)) + codeDir = os.path.abspath(os.path.dirname(sourceDir)) + if codeDir not in sys.path: + sys.path.insert(0, codeDir) import wypp.runner as r r.main(globals()) diff --git a/python/code/wypp/runner.py b/python/code/wypp/runner.py index 38f67a7..4664c11 100644 --- a/python/code/wypp/runner.py +++ b/python/code/wypp/runner.py @@ -1,9 +1,6 @@ import os import sys -from . import constants -sys.path.insert(0, constants.CODE_DIR) - requiredVersion = (3, 12, 0) def pythonVersionOk(v): (reqMajor, reqMinor, reqMicro) = requiredVersion diff --git a/python/run b/python/run index faf34d8..06e6f6b 100755 --- a/python/run +++ b/python/run @@ -11,6 +11,6 @@ OPTS="--quiet" # For profiling, uncomment the line below # PROF="-m cProfile -o profile.out" -PYTHONPATH="$SCRIPT_DIR"/code:"$PYTHONPATH" $PY $PROF "$SCRIPT_DIR"/code/wypp/runYourProgram.py \ +$PY $PROF "$SCRIPT_DIR"/code/wypp/runYourProgram.py \ --no-clear $OPTS "$@" exit $?