Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Guilhem Saurel
dynamic-graph-python
Commits
7237c399
"git@gitlab.laas.fr:stack-of-tasks/eigenpy.git" did not exist on "e2ab314eef9062d44802445f92be7fd7a41f625f"
Commit
7237c399
authored
12 years ago
by
olivier stasse
Browse files
Options
Downloads
Patches
Plain Diff
Changes std::cout to dgDEBUG.
parent
fe0a6faf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/interpreter.cc
+16
-12
16 additions, 12 deletions
src/interpreter.cc
with
16 additions
and
12 deletions
src/interpreter.cc
+
16
−
12
View file @
7237c399
...
...
@@ -15,6 +15,7 @@
// dynamic-graph. If not, see <http://www.gnu.org/licenses/>.
#include
<iostream>
#include
"dynamic-graph/debug.h"
#include
"dynamic-graph/python/interpreter.hh"
#include
"link-to-python.hh"
...
...
@@ -48,11 +49,12 @@ bool HandleErr(std::string & err,
PyObject
*
globals_
,
int
PythonInputType
)
{
dgDEBUGIN
(
15
);
err
=
""
;
bool
lres
=
false
;
if
(
PyErr_Occurred
())
{
std
::
cout
<<
"v3.0 An exception was raised in the python interpreter."
<<
std
::
endl
;
PyObject
*
ptype
,
*
pvalue
,
*
ptraceback
,
*
pyerr
;
PyErr_Fetch
(
&
ptype
,
&
pvalue
,
&
ptraceback
);
if
(
ptraceback
==
NULL
)
{
...
...
@@ -71,7 +73,7 @@ bool HandleErr(std::string & err,
}
pyerr
=
PyString_FromString
(
stringRes
.
c_str
());
err
=
PyString_AsString
(
pyerr
);
std
::
cout
<<
"err: "
<<
err
<<
std
::
endl
;
dgDEBUG
(
15
)
<<
"err: "
<<
err
<<
std
::
endl
;
// Here if there is a syntax error and
// and the interpreter input is set to Py_eval_input,
...
...
@@ -80,7 +82,7 @@ bool HandleErr(std::string & err,
if
(
PyErr_GivenExceptionMatches
(
ptype
,
PyExc_SyntaxError
)
&&
(
PythonInputType
==
Py_eval_input
))
{
std
::
cout
<<
"Detected a syntax error "
<<
std
::
endl
;
dgDEBUG
(
15
)
<<
"Detected a syntax error "
<<
std
::
endl
;
lres
=
false
;
}
else
...
...
@@ -88,7 +90,7 @@ bool HandleErr(std::string & err,
PyErr_Clear
();
}
else
{
std
::
cout
<<
"no object generated but no error occured."
<<
std
::
endl
;
dgDEBUG
(
15
)
<<
"no object generated but no error occured."
<<
std
::
endl
;
}
PyObject
*
stdout_obj
=
PyRun_String
(
"stdout_catcher.fetch()"
,
Py_eval_input
,
globals_
,
...
...
@@ -98,8 +100,9 @@ bool HandleErr(std::string & err,
out
=
PyString_AsString
(
stdout_obj
);
// Local display for the robot (in debug mode or for the logs)
if
(
out
.
length
()
!=
0
)
std
::
cout
<<
out
;
else
std
::
cout
<<
"No exception."
<<
std
::
endl
;
{
dgDEBUG
(
15
)
<<
std
::
endl
;
}
else
{
dgDEBUG
(
15
)
<<
"No exception."
<<
std
::
endl
;
}
dgDEBUGOUT
(
15
);
return
lres
;
}
...
...
@@ -173,7 +176,8 @@ void Interpreter::python( const std::string& command, std::string& res,
// If there is no error, make sure that the previous error message is erased.
err
=
""
;
}
else
std
::
cout
<<
"Do not try a second time."
<<
std
::
endl
;
else
{
dgDEBUG
(
15
)
<<
"Do not try a second time."
<<
std
::
endl
;
}
}
PyObject
*
stdout_obj
=
PyRun_String
(
"stdout_catcher.fetch()"
,
...
...
@@ -187,14 +191,14 @@ void Interpreter::python( const std::string& command, std::string& res,
// then results is equal to NULL. This will trigger a SEGV
if
(
result
!=
NULL
)
{
std
::
cout
<<
"For command :"
<<
command
<<
std
::
endl
;
dgDEBUG
(
15
)
<<
"For command :"
<<
command
<<
std
::
endl
;
res
=
PyString_AsString
(
result
);
std
::
cout
<<
"Result is: "
<<
res
<<
std
::
endl
;
std
::
cout
<<
"Out is: "
<<
out
<<
std
::
endl
;
std
::
cout
<<
"Err is :"
<<
err
<<
std
::
endl
;
dgDEBUG
(
15
)
<<
"Result is: "
<<
res
<<
std
::
endl
;
dgDEBUG
(
15
)
<<
"Out is: "
<<
out
<<
std
::
endl
;
dgDEBUG
(
15
)
<<
"Err is :"
<<
err
<<
std
::
endl
;
}
else
std
::
cout
<<
"Result is empty"
<<
std
::
endl
;
{
dgDEBUG
(
15
)
<<
"Result is empty"
<<
std
::
endl
;
}
return
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment