Re: Python & VxWorks anyone?

Chris De Souza (chrisd@aus.hp.com)
Fri, 23 Sep 1994 03:53:20 GMT

thor@ymir.atd.ucar.EDU wrote:
: A while back chrisd@aus.hp.com (Chris De Souza) wrote:

: |> We require the ability to run multiple Python sessions in parallel
: |> under VxWorks.

: I've unable to contact him directly. I'm also interested in python
: hosted on VxWorks, although I don't mind if it's not reentrant. Has
: anyone been able to get python running under VxWorks & if so would you
: please share the wealth?

I have been able to get Python 1.0.3 to run under Intel i960/VxWorks using the
GNU2.5.6 cross compiler for this platform. A few points are of note:
- I have omitted the built-in time and posix modules since VxWorks does not
support all the functions in them. However, I will be looking at
modifying these modules so that some of their functionality can be retained.
- VxWorks does not include the functions _exit and getpid and dummy functions
need to be written for these.
- I had considerable problems with stdout which were all solved by forcing
stdout to be line buffered using the "setvbuf" function at the start of the
Python program.
- If Python is run from the shell ie. -> main(1,"python")
CNTRL-D and sys.exit() call the VxWorks routine exit() which will try and
terminate the VxWorks shell. The fix (though not very pretty) for this is
is to use CNTRL-C.
An alternative is to run Python as a spawned task ie. -> sp(main,1,"python")
The trouble with this is that under VxWorks a spawned task cannot access
stdin or stdout (unless it is the shell).
The neatest solution (without having to alter much Python code) is to use the
VxWorks ioTaskStdSet function to redirect stdin and stdout to files (and
make sure these are closed prior to the Python exit). By redirecting stdout
I have also been able to successfully embed Python, using the Python function
run_command() from my main program.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris de Souza Email: chrisd@hpato.aus.hp.com
Australian Telecom Operation
Hewlett-Packard Australia Ltd
31 Joseph St, Blackburn 3130, Australia