-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonTool.h
More file actions
74 lines (66 loc) · 1.79 KB
/
Copy pathpythonTool.h
File metadata and controls
74 lines (66 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once
//#include <python.h>
#include <string>
#include <vector>
#pragma warning(disable:4996)
using namespace std;
class pythonTool
{
std::vector<std::string> m_fileList;
public:
pythonTool()
{
}
~pythonTool()
{
//Py_Finalize();
}
//void Pythoninit()
//{
// Py_SetPythonHome(L"C:\\ProgramData\\Anaconda3");
// Py_Initialize();
// PyRun_SimpleString("import sys");
//
// //PyRun_SimpleString("sys.path.append( 'F:/project/TissueProject/TissueApp/bin/upython' )");
// PyRun_SimpleString("sys.path.append( 'F:/project/TissueProject/TissueApp/bin/upython' )");
// // PyRun_SimpleString("sys.path.append( '../upython' )");
// PyRun_SimpleString("sys.path");
// PyRun_SimpleString("print ('------------------------------------') ");
//}
//bool pyReadfilelist(std::vector<std::string> filelist)
//{
// PyObject* pModule = NULL;
// PyObject* pFun = NULL;
// PyObject* pFun_List = NULL;
// PyObject * pArg = NULL;
// char listff[50] = { 0 };
// pModule = PyImport_ImportModule("readfilelist");
// if (NULL != pModule)
// {
// // printf("python module ok\n");
// //pFun = PyObject_GetAttrString(pModule, "Hello");
// pArg = Py_BuildValue("(s)", "F:\project\TissueProject\nature");
// pFun_List = PyObject_GetAttrString(pModule, "get_files");
// PyObject* pRet = PyEval_CallObject(pFun_List, pArg);
// int list_len = PyObject_Size(pRet);
// if (list_len>=1)
// {
// PyObject* list_item = NULL;
// char *str_item = NULL;
// str_item = new char[255];
// for (int i = 0; i < list_len; i++)
// {
// PyObject* keylist = PyList_GetItem(pRet, i);
// sprintf(str_item, "%s", _PyUnicode_AsString(keylist));
// printf("%s\n", str_item);
// filelist.push_back(str_item);
// }
// return true;
// }
//
//
// }
//
// return false;
//}
};