Code Monkey home page Code Monkey logo

Comments (4)

blink1073 avatar blink1073 commented on July 19, 2024

That is tricky, I'll have to see if I can detect this condition. Otherwise, all I can do is document this shortcoming.

from oct2py.

blink1073 avatar blink1073 commented on July 19, 2024

I found a fix for this, I had to read characters instead of lines and look for the debug> prompt. I can recover the session, but I have to raise an Oct2PyError because the command does not complete successfully. Snippet:

           line = []
           while 1:
                char = self.proc.stdout.read(1).decode('utf-8')
                if char == '\n':
                    break
                elif char == '>' and ''.join(line) == 'debug':
                    self.proc.stdin.write('dbquit\n')
                    raise Oct2PyError('Debug point found, check for keyboard command:\n%s' % main_line)
                line.append(char)
            line = ''.join(line).strip()

I still need to update the test suite before finalizing, but I am out of gas the for now.

from oct2py.

blink1073 avatar blink1073 commented on July 19, 2024

Woohoo, now that I'm thinking clearly again, I was able to add full support for keyboard and debug points. A simple example:

from oct2py import octave as oc
oc.put('a', 1)
oc.keyboard()

A session might look like:

Entering Octave Debug Prompt...
debug> a
a = 1
debug> return
>>>

This resides in the dev branch for now. I will fix #32 and then push a new release.

from oct2py.

moorepants avatar moorepants commented on July 19, 2024

Very cool, thanks a lot!

from oct2py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.