Skip to content

Commit

Permalink
#2285 Adjusted the path for python scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Apr 7, 2023
1 parent 6308f78 commit 30e28bf
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions src/tools/other/ascii2nc/python_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ using namespace std;

#include "vx_log.h"
#include "vx_math.h"
#include "python_line.h"

#include "vx_python3_utils.h"
#include "python_handler.h"


////////////////////////////////////////////////////////////////////////


static const char set_python_env_wrapper [] = "set_python_env";

static const char write_tmp_ascii_wrapper[] = "MET_BASE/wrappers/write_tmp_point.py";
static const char write_tmp_ascii_wrapper[] = "MET_BASE/python/pyembed/write_tmp_point.py";

static const char list_name [] = "point_data";

Expand Down Expand Up @@ -247,9 +245,7 @@ bool PythonHandler::do_straight()

{

ConcatString command, path, user_base;

path = set_python_env_wrapper;
ConcatString command, user_base;

mlog << Debug(3)
<< "Running user's python script ("
Expand All @@ -263,15 +259,15 @@ user_base.chomp(".py");
// start up the python interpreter
//

Python3_Script script(path.text());
Python3_Script *script = get_python3_script();

//
// set up a "new" sys.argv list
// with the command-line arquments for
// the user's script
//

script.reset_argv(user_script_filename.text(), user_script_args);
script->reset_argv(user_script_filename.text(), user_script_args);

//
// import the user's script as a module
Expand Down Expand Up @@ -380,20 +376,16 @@ if ( status ) {

}

ConcatString wrapper;

wrapper = set_python_env_wrapper;

Python3_Script script(wrapper.text());
Python3_Script *script = get_python3_script();

mlog << Debug(4) << "Reading temporary Python ascii observation file: "
<< tmp_ascii_path << "\n";

script.import_read_tmp_ascii_py();
script->import_read_tmp_ascii_py();

PyObject * dobj = script.read_tmp_ascii(tmp_ascii_path.text());
PyObject * dobj = script->read_tmp_ascii(tmp_ascii_path.text());

PyObject * obj = script.lookup_ascii(tmp_list_name);
PyObject * obj = script->lookup_ascii(tmp_list_name);

if ( ! PyList_Check(obj) ) {

Expand Down

0 comments on commit 30e28bf

Please sign in to comment.