Okay you see I have an idea of implementing this. Lets not do this using libraries.
So what is the technique that I propose:
We all know that in a .php file we can write html and php code. They are just differentiated on the basis of tags. I propose to do just the same thing for python and octave. Let us integrate the compilers of python and Octave. As soon as the lexical analyzer notices the opening tag of the octave code the parser and the semantic analyzer of octave handles the section. And as soon as the lexical analyzer encounters the opening tag of the python the parser and semantic analyzer of python is called.
I guess you guess are understanding what I exactly propose to do. I can do this job but then I will need the codebase of python and octave parsers to understand and execute this task.
Please drop in some suggestions.