Allow vpython to be used remotely on a headless Pi #111
+43
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes are designed for using VPython on a headless (no screen/keyboard attached, remotely operated) Raspberry Pi. This is ideal for graphing or visualizing vectors and sensor data.
It could be used in other headless contexts.
By specifying the environment variables
VPYTHON_PORT
a specific port number can be chosen instead of randomly assigning a free one. This means it can consistently offer the same port (useful when headless).Also on the headless Pi, it will be unable to launch a browser. So setting the
VPYTHON_NOBROWSER
environment variable just prints the URL instead.It's imperfect, in that it still prints a "localhost" address instead of the device hostname (or .local name), and it seems not to play well with being closed, and then reopened on the same port (some kind of port binding issue).
A further todo of mine would be to change the exit conditions - so it's not down to the last browser to leave, but instead a specific stop condition. This time perhaps based on a runtime setting.