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
Stack Of Tasks
dynamic-graph-python
Commits
5bee2872
Commit
5bee2872
authored
14 years ago
by
Nicolas Mansard
Committed by
Nicolas Mansard
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Modify the "runFile" function that was not working, at create a new function to call for the shell.
parent
4562d981
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/dynamic-graph/python/interpreter.hh
+1
-0
1 addition, 0 deletions
include/dynamic-graph/python/interpreter.hh
src/interpreter.cc
+14
-7
14 additions, 7 deletions
src/interpreter.cc
with
15 additions
and
7 deletions
include/dynamic-graph/python/interpreter.hh
+
1
−
0
View file @
5bee2872
...
...
@@ -44,6 +44,7 @@ namespace dynamicgraph {
/// \brief Method to exectue a python script.
/// \param filename the filename
void
runPythonFile
(
std
::
string
filename
);
void
runMain
(
void
);
/// \brief Process input stream to send relevant blocks to python
/// \param stream input stream
...
...
This diff is collapsed.
Click to expand it.
src/interpreter.cc
+
14
−
7
View file @
5bee2872
...
...
@@ -100,13 +100,20 @@ std::string Interpreter::python( const std::string& command )
void
Interpreter
::
runPythonFile
(
std
::
string
filename
)
{
Py_Finalize
();
Py_Initialize
();
PyRun_SimpleString
(
pythonPrefix
[
0
].
c_str
());
PyRun_SimpleString
(
pythonPrefix
[
1
].
c_str
());
PyRun_SimpleString
(
pythonPrefix
[
2
].
c_str
());
PyRun_SimpleString
(
pythonPrefix
[
4
].
c_str
());
PyRun_SimpleFile
(
NULL
,
filename
.
c_str
());
PyObject
*
pymainContext
=
globals_
;
PyRun_File
(
fopen
(
filename
.
c_str
(),
"r"
),
filename
.
c_str
(),
Py_file_input
,
pymainContext
,
pymainContext
);
if
(
PyErr_Occurred
())
{
std
::
cout
<<
"Error occures..."
<<
std
::
endl
;
PyErr_Print
();
}
}
void
Interpreter
::
runMain
(
void
)
{
const
char
*
argv
[]
=
{
"dg-embedded-pysh"
};
Py_Main
(
1
,
const_cast
<
char
**>
(
argv
));
}
std
::
string
Interpreter
::
processStream
(
std
::
istream
&
stream
,
std
::
ostream
&
os
)
...
...
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