File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ bool CPythonManager::Initialize( void )
225225 catch ( ... ) {
226226 Msg (MSG_PREFIX " Failed to load the main module due to following exception:\n " );
227227
228- // Don't use PyErr_Print() here because our sys.excepthook has not been installed
228+ // Don't use PyErr_Print() here because our sys.excepthook (might) has not been installed
229229 // yet so let's just format and output to the console ourself.
230230 if (PyErr_Occurred ())
231231 {
@@ -240,7 +240,10 @@ bool CPythonManager::Initialize( void )
240240 handle<> hTraceback (allow_null (pTraceback));
241241
242242 object format_exception = import (" traceback" ).attr (" format_exception" );
243- Msg (extract<const char *>(str (" \n " ).join (format_exception (hType, hValue, hTraceback))));
243+ const char * pMsg = extract<const char *>(str (" \n " ).join (format_exception (hType, hValue, hTraceback)));
244+
245+ // Send the message in chunks, because it can get quite big.
246+ ChunkedMsg (pMsg);
244247
245248 PyErr_Clear ();
246249 }
Original file line number Diff line number Diff line change 3131// -----------------------------------------------------------------------------
3232#include " utilities/wrap_macros.h"
3333#include " boost/python.hpp"
34- #include " strtools.h"
3534
35+ // SDK
36+ #include " strtools.h"
37+ #include " dbg.h"
3638
3739// -----------------------------------------------------------------------------
3840// Namespaces to use
3941// -----------------------------------------------------------------------------
4042using namespace boost ::python;
4143
44+ // -----------------------------------------------------------------------------
45+ // Send a message in chunks
46+ // -----------------------------------------------------------------------------
47+ #define MAX_CHUNK 1024
48+
49+ inline void ChunkedMsg (const char * msg)
50+ {
51+ char * pMsg = (char *) msg;
52+ int iLen = strlen (msg);
53+
54+ while (iLen > 0 ) {
55+ Msg (pMsg);
56+ pMsg += MAX_CHUNK -1 ;
57+ iLen -= MAX_CHUNK -1 ;
58+ }
59+ }
60+
4261// -----------------------------------------------------------------------------
4362// Returns True if the class name of the given object equals the given string.
4463// -----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments