Code Monkey home page Code Monkey logo

Comments (8)

moorepants avatar moorepants commented on July 19, 2024

One more thing about this. If you have a syntax error in your code, when help(my_function) is called by _get_doc you get this same obscure error about the command not being available. The _get_doc call is failing on the help command but because there is a syntax error.

from oct2py.

blink1073 avatar blink1073 commented on July 19, 2024

Another good catch. I have the flu, so it may be a little while before I get to it.

from oct2py.

moorepants avatar moorepants commented on July 19, 2024

Sorry, hope you feel better.

I tried to figure it out but I wasn't sure what elif line == '\x15' actually is checking for.

from oct2py.

blink1073 avatar blink1073 commented on July 19, 2024

I wrap the commands in a try/catch block in Octave. If all goes well,
Octave prints char(3), which is '\x03'. If an error is thrown, Octave
prints char(21), which is '\x15', which is what I am checking for in that
line. Basically, I need to rethink the way I check for the existence of a
function, and not require it to have a docstring.

On Wed, Dec 18, 2013 at 9:58 PM, Jason Moore [email protected]:

Sorry, hope you feel better.

I tried to figure it out but I wasn't sure what elif line == '\x15'actually is checking for.


Reply to this email directly or view it on GitHubhttps://github.com//issues/32#issuecomment-30903507
.

from oct2py.

blink1073 avatar blink1073 commented on July 19, 2024

That logic is in Oct2Py.__getattr__, which calls Oct2Py._get_doc for
any unknown attribute lookup.

On Wed, Dec 18, 2013 at 10:10 PM, Steven Silvester <
[email protected]> wrote:

I wrap the commands in a try/catch block in Octave. If all goes well,
Octave prints char(3), which is '\x03'. If an error is thrown, Octave
prints char(21), which is '\x15', which is what I am checking for in that
line. Basically, I need to rethink the way I check for the existence of a
function, and not require it to have a docstring.

On Wed, Dec 18, 2013 at 9:58 PM, Jason Moore [email protected]:

Sorry, hope you feel better.

I tried to figure it out but I wasn't sure what elif line == '\x15'actually is checking for.


Reply to this email directly or view it on GitHubhttps://github.com//issues/32#issuecomment-30903507
.

from oct2py.

blink1073 avatar blink1073 commented on July 19, 2024

Here's what should happen now (in the dev branch):

If the function exists and has a docstring, we use that. If it exists and does not have a docstring, we use a blurb about the function and the function declaration (assuming it is on the top line of the file). Example:

temp_oct2py_func is the user-defined function defined from: C:\Users\silvester\Documents\Python Scripts\temp_oct2py_func.m

function [outp] = temp_oct2py_func(inp)

If it does not exist, we raise an error similar to:

oct2py.utils.Oct2PyError: Function "temp3" does not exist on the Octave session path

Unfortunately, if the script has a syntax error, Octave closes the connection (but we raise an error with a notification). I cannot figure out how to avoid that behavior.

from oct2py.

moorepants avatar moorepants commented on July 19, 2024

Looks good.

Maybe on the closed connection error, you could suggest to the user to ensure the m file works from Octave.

from oct2py.

blink1073 avatar blink1073 commented on July 19, 2024

I'll add the line If using an m-file script, make sure it runs in Octave to the error message. Also, I added the ability to use pexpect on non-Windows platforms, which prevents Octave from closing the connection when there is a Syntax Error (since it registers as a tty connection). Thanks again!

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.