Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to have more informative error messages? #31

Open
WillAdams opened this issue Sep 2, 2024 · 5 comments
Open

Possible to have more informative error messages? #31

WillAdams opened this issue Sep 2, 2024 · 5 comments

Comments

@WillAdams
Copy link

If one has a very basic Python file such as:

#!/usr/bin/env python

def psettool(tn):
    global currenttool
    currenttool = tn

def pcurrent_tool():
    global currenttool
    return currenttool

which is loaded in:

use <gcptest.py>;

/* [CAM] */
small_square_tool_no = 122; // [0:0,122:122,112:112,102:102]

psettool(small_square_tool_no);

echo(str(pcurrent_tool()));
echo(str(pcurrent_tool(small_square_tool_no)));

Then the last line will generate the error:

WARNING: Ignoring unknown function 'pcurrent_tool' in file gcptest.scad, line 9

which is quite confusing to a naïve programmer --- would it be possible to have the message instead explain that the function was not called correctly?

@gsohler
Copy link
Owner

gsohler commented Sep 3, 2024

yes, confirmed error.
the message should rather say, that neither a python function nor a openscad function could be called.

@gsohler
Copy link
Owner

gsohler commented Sep 23, 2024

Today I was working on better error handling.
Now pythonscad is able to display

  • when there is a general parsing error in the python file (and which)
  • if neither such a python nor scad module is found
  • if there is a parameter mismatch in the called python function (and which)
  • if there is an error during evaluatin of the python function(and which)

I have released 09-23 today.
Let me know if error handling is missing some "features"

@WillAdams
Copy link
Author

Nice!

image

I'll keep an eye out for messages which don't make sense to me and keep you posted.

@WillAdams
Copy link
Author

Reopening this because the line:

help('modules')

in a .py file instantly crashes 2024.09.23

@WillAdams WillAdams reopened this Sep 24, 2024
@gsohler
Copy link
Owner

gsohler commented Sep 24, 2024

This only happens with the windows distribution and the error happens in the python3.11.dll
Right now I dont know, how to address it
(same story: you cannot import ctypes lib in PythonSCAD under windows)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants