Comments (6)
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.
One last thing about testing -- we need to be sure that complex errors do not get masked by the simplified traceback.
from shoebot.
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.
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.
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.
About 2 years too late have integrated the change from this branch.
from shoebot.
Related Issues (20)
- Option for text() to be drawn with (x,y) being the top left corner, not baseline
- Socket control and puredata example fixes. HOT 2
- Saving a snapshot of a script with draw() repeats more than 300 times HOT 4
- Variables window only shows when the --window option is used
- Broken links on front page HOT 2
- Support miter limits on stroke joins HOT 2
- Include pprint() in utility functions HOT 3
- The text() width property does nothing, same with align() HOT 1
- Could not build wheels for pygobject which use PEP 517 and cannot be installed directly HOT 1
- Python 3.10 - collections.Mapping moved to collections.abc.Mapping HOT 2
- GUI tests freeze HOT 1
- release 1.4
- Update our setup.py ..
- Nodebox compatibility - does scale() affect the origin of shapes ? HOT 19
- Release 1.4.2
- Can't install gedit plugin now gedit has versions > 40.0
- Test wrapper - del some variables to give allow objects to be destroyed at test tear down.
- ximport improvements (and possibly import) HOT 18
- collections.Mapping not supported anymore in Python 3.10 HOT 1
- Docs fixes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shoebot.