I found the error. In the documentation, the example Python script is:
#! /opt/bin/python
print "Python test: Hello world!"
But in my Juniper MX 480 router, python binary is located in /usr/bin/python. Then script should be:
#! /usr/bin/python
print "Python test: Hello world!"
I reinstalled the bundle with this change and it worked in the router.
Junos SDK documentation is plenty of this kind of small errors. It makes the development process a nightmare and sometimes one feel like an idiot because there is no progress during learning process. I desire you, Juniper, improve documentation to make easier developers life.
PD: Other mistakes in this page:
1) In "Preparing the Sandbox" section, the instructions to create Makefile are:
# Note we are positioned at /home/user/sandboxes/test-python/src
$ mkdir -p package-scripts/test-python
$ echo ".include ../Makefile.inc" > package-scripts/test-python/Makefile
but hits period (".") should be removed and the result should be:
# Note we are positioned at /home/user/sandboxes/test-python/src
$ mkdir -p package-scripts/test-python
$ echo "include ../Makefile.inc" > package-scripts/test-python/Makefile
If the period is present, an error is produced during mk process:
bmake: "/usr/home/user/sandboxes/test-python/src/package-scripts/test-python/Makefile" line 1: .include filename must be delimited by '"' or '<'
2) In the "Creating the Package Manifest" section, there is an example of manifext file like this:
# package_id must be a unique value from 0-31
# role must be Provider_Application
/set package_id=32 role=Provider_Application
# Each script must have a unique program_id value from 0-63
%TOPDIR%/py-scripts/test-python.py store=opt/sdk/juniper/test-python.py mode=555 program_id=1
There are one susicious error here. It says package_id must be a unique value from 0-31, but it uses 32 as value. I don't know the consequences of this value, but I used a valid value in the range and it worked.
3) In the previous file, it is important to notice that store flag (store=opt/sdk/juniper/test-python.py) must point to local company used to generate certificate, something like this: store=opt/sdk/<my_company>/test-python.py. If it is not the case, an error will be produced during mk process:
ERROR: makeiso: test-python.py should be stored under 'opt/sdk/<my_company>' sub-directory
I consider there are too many errors in documentation and the user of it will be stucked during the learning process if he could not guess how to solve them.
Hope it could help other users.