Previously embedPy only provided the return 'value' of an error retrieved from Python rather than the full traceback. This is shown in the following example
a.py
import numpy as np
class Element:
def __init__(self): pass
a = Element()
periodicTable = np.array(range(7*32)).reshape((7,32))
periodicTable[0][0] = a
When imported this file causes an error however it does not provide information relating to the location of the error in the loaded file as would be provided by the Python traceback
$ q p.q
q).p.import[`a]
'import: int() argument must be a string, a bytes-like object or a number, not 'Element'
Users can now modify how errors are returned within their system by running .p.setpyerr[1] which will update the format that the error message gets returned, namely returning the error traceback if it can be formed so that it can be parsed by the user within a protected execution. This is left to the user.
$ q p.q
q).p.setpyerr[1]
q).p.getpyerr[]
1
q).p.import[`a]
'import: ['Traceback (most recent call last):\n', ' File "/Users/conormccarthy/projects/fusion/embedpy/embedpy_conor/a.py", line 8, in <module>\n periodicTable[0][0] = a\n', "TypeError: int() argument must be a string, a bytes-like object or a number, not 'Element'\n"]
q).p.setpyerr[0]
q).p.import[`a]
'import: int() argument must be a string, a bytes-like object or a number, not 'Element'
q).p.getpyerr[]
0
Updated the makefile to move p.q and p.k to $QHOME in line with any changes to these files
Updated the .gitignore to ignore any artefacts generated during the make process
Updated the makefile to make the p.so during a make install if not already generated
Updated the buffer logic for error message display, previously the fixed maximum buffer size had no protection against buffer overflow. This was not an issue as the buffer size was much greater than could be expected to be returned from the truncated error messaging. With traceback this is no longer the case.
Previously embedPy only provided the return 'value' of an error retrieved from Python rather than the full traceback. This is shown in the following example
a.py
When imported this file causes an error however it does not provide information relating to the location of the error in the loaded file as would be provided by the Python traceback
Users can now modify how errors are returned within their system by running
.p.setpyerr[1]
which will update the format that the error message gets returned, namely returning the error traceback if it can be formed so that it can be parsed by the user within a protected execution. This is left to the user.p.q
andp.k
to$QHOME
in line with any changes to these files.gitignore
to ignore any artefacts generated during the make processmake
thep.so
during amake install
if not already generated