Running a Python3 application
The Hadean Platform SDK also comes with Python bindings. In this tutorial we will look at how we can install them and use them to run the
In order to install the bindings, you will need the following dependencies:
python3(version >= 3.5)
Once we have these, we can go ahead and install the bindings:
$ pip3 install ~/.hadean/sdk/etc/packages/python/hadean-0.0.1.tar.gz
The above will install the bindings into
First, let's find out the version of Python we are running:
$ python3 --version
# let's export a variable to make things easier
$ export PY_VERSION="3.9"
Now we can go ahead and run our application:
$ hadean run $(which python3) \
[2022-01-18T16:33:18Z INFO ] Starting application...
[2022-01-18T16:33:32Z INFO ] 127.0.0.1.18003.0: Hello from parent!
[2022-01-18T16:33:32Z INFO ] 127.0.0.1.18003.0: Child says Hello!
[2022-01-18T16:33:33Z INFO ] Application exited (0)
So what happened there, and what's up with that
Our application runs in a sandboxed environment, but in order to run our
hello.pyexample we need a few things:
python3which is copied by
hadean runfor us
- the standard Python3 packages, which are found in
hello.pyfile which we want Python to execute
--mappingsargument helps us move a set of files and directories into the environment in which
python3will run. Without "mapping" these files,
python3would probably output something like:
[2022-01-18T16:36:23Z INFO ] Starting application...
[2022-01-18T16:36:24Z ERROR] 127.0.0.1.18003.0: Could not find platform independent libraries <prefix>
[2022-01-18T16:36:24Z ERROR] 127.0.0.1.18003.0: Could not find platform dependent libraries <exec_prefix>
[2022-01-18T16:36:24Z ERROR] 127.0.0.1.18003.0: Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
[2022-01-18T16:36:24Z ERROR] 127.0.0.1.18003.0: Python path configuration:
[2022-01-18T16:36:24Z ERROR] 127.0.0.1.18003.0: PYTHONHOME = (not set)
[2022-01-18T16:36:24Z ERROR] 127.0.0.1.18003.0: PYTHONPATH = (not set)