如何重新加载更新的jsl文件我有一个包含鬃毛列表的jsl文件(list.jsl)。喜欢以下。该文件通过运行从我的GUI.jsl调用的python文件进行更新
我正在尝试通过调用一个名为 MongoDB_table_list_refresh-基本上是试图重新加载更新的文件。
但这是错误的!任何想法如何解决它或任何新方法?
</CODE></STRONG></P><PRE><CODE class=" language-jsl">MongoDB_table_list_refresh = Expr(
Include( "./GUI_Files/Lists.jsl" );
);GUI.jsl
Button Box( " Refresh\!NCollections",
Caption( "Loading collections from Mongo DB. \!NPlease wait..." );
Wait( 0 );
RunProgram( executable( "python" ), options( mongo_path || "update_mongo_tables_lists_file.py" ) );
Caption( remove );
MongoDB_table_list_refresh;
selected_db = Database_name << get selected;
If( selected_db == "mongo_dev_amr",
Mongo_Table << Set Items( Mongo_table_list_mongo_dev_amr )
);
If( selected_db == "mongo_amr",
Mongo_Table << Set Items( Mongo_table_list_mongo_amr )
);list.jsl
Mongo_table_list_mongo_dev_amr = { "ddr_dv_dev", "ddr_dv_pi", "ddr_internal", "ddr_comp_fsm", "ddr_ac", "ddr_dc" }; // This variable is auto updated by generate_mongo_tables_lists_file.py
Mongo_table_list_mongo_amr = { "ddr_internal" }; // This variable is auto updated by generate_mongo_tables_lists_file.py回复:如何重新加载更新的jsl文件错误消息是什么,产生它的程序是什么?
可能您想将readfunction(“ text”)添加到runprogram参数中。
回复:如何重新加载更新的jsl文件我们通过将python纳入其中找到了解决方案。直接从python获取更新的列表作为列表,然后解析它。在这种情况下,我们不必刷新并检查更新此列表的文件。
output = RunProgram( executable( "python" ),
options( mongo_path || "update_mongo_tables_lists_file.py"),
readfunction( "text" )
);
lines = Words (output, "\!N");
For( i = 1 , i <= N Items( lines ), i++,
If( Pat Match( lines[i], "[" ),
db_str = Word (2, Word (1, lines[i], ":"));
collection_str = Word (1, Word (2, lines[i], "["), "]");
collection_str = Substitute (collection_str, ",", "");
collection_str = Substitute (collection_str, "'", "");
collection_list = Words (collection_str);
if( db_str == "mongo_dev_amr",
Mongo_table_list_mongo_dev_amr = collection_list );
if( db_str == "mongo_amr",
Mongo_table_list_mongo_amr = collection_list );
selected_db = Database_name << get selected;
if( db_str == selected_db,
Mongo_Table << Set Items( collection_list ); );
),
);