Coder Social home page Coder Social logo

Comments (6)

rlafuente avatar rlafuente commented on May 23, 2024

I started a new branch to deal with this, and done an initial commit (94fb8ef) that trims down the full traceback into a simple error message, along with the offending line. Example:

Error in the Shoebot script, line 1:
    rect(40,40,40)
TypeError: rect() takes at least 5 arguments (4 given)

There's still a bit of work needed:

  • The error in this test script mentions 5 arguments when in fact rect() takes 4, since rect() is actually a Bot method that takes Bot as the first argument. So I'm thinking that a regex replacement would be good here, subtracting 1 in the error message numbers in the relevant cases in order to present to the user the correct argument number.
  • Verbose mode would show the full traceback. I need help here, since the code pipeline changed quite a bit and I haven't yet sat down to fully grok the new Bot/Grammar model in order to add new parameters.
  • This branch needs more testing, especially with the Gedit plugins. The print statements might be problematic -- how can we pipe the output to stdout for CLI scripts, and to the Gedit output buffer for scripts run from Gedit?

from shoebot.

rlafuente avatar rlafuente commented on May 23, 2024

One last thing about testing -- we need to be sure that complex errors do not get masked by the simplified traceback.

from shoebot.

stuaxo avatar stuaxo commented on May 23, 2024

This is a good point about testing.

I think Gedit will be OK, certainly for Gedit3 it'll just be using subprocess running sbot. For Gedit2 I'm fairly sure it's possible to redirect stderr (using the same method as the IDE did).

We'll need to be careful using a regex replacement

  • ideally it will only apply to the calls from the script into the bot grammar (functions in classes that extend grammar.Grammar - this will cover nodebot.Nodebot and drawbot.Drawbot and any future grammars).

We need to not munge output if the user overrides one of our methods...

I guess it might be possible to walk the trace stack to check they are the correct calls somehow ?

from shoebot.

stuaxo avatar stuaxo commented on May 23, 2024

Verbose mode would show the full traceback. I need help here, since the code pipeline changed quite a bit and I
haven't yet sat down to fully grok the new Bot/Grammar model in order to add new parameters.

To add a param you'd add it to init_bot inside shoebot/sbot.py this convenience function then pass it to the bot constructor (DrawBot or NodeBot) - then it'd probably be store it inside the Grammar class.

Bot is for stuff that is common to the NodeBot/DrawBot grammars (probably a lot more could be moved here, though I'm not sure this yet, as I'd like to consider supporting say the NodeBoxGL grammar which is kind of different).

Grammar is a lot more basic and has the mecanics to run stuff, but doesn't specify how.

Having a look at the updated gist on how shoebot works as a module https://gist.github.com/1322704 is a good place to see init_bot without loads of parameters.

This branch needs more testing, especially with the Gedit plugins. The print statements might be problematic -- how > can we pipe the output to stdout for CLI scripts, and to the Gedit output buffer for scripts run from Gedit?

The code for this hasn't fully settled down, but it can definitely be made to work (it works most of the time in gedit3, but I'm not fully happy - I still crash it regularly - however as proof of concept it's fine.).

from shoebot.

stuaxo avatar stuaxo commented on May 23, 2024

I've added the verbose parameter to sb_run - though non functional, I'm not sure what to change in the traceback code, so back to you :)

from shoebot.

stuaxo avatar stuaxo commented on May 23, 2024

About 2 years too late have integrated the change from this branch.

from shoebot.

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.