Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit f987db9

Browse files
committed
fixes for windows
1 parent 3513d4f commit f987db9

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/python_interpreter.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ inline pybind11::module pyobject_from_gobj(gpointer ptr){
1414
}
1515

1616
Python::Interpreter::Interpreter(){
17+
#ifdef _WIN32
18+
auto root_path=Config::get().terminal.msys2_mingw_path;
19+
append_path(root_path/"include/python3.5m");
20+
append_path(root_path/"lib/python3.5");
21+
long long unsigned size = 0L;
22+
#else
23+
long unsigned size = 0L;
24+
#endif
1725
auto init_juci_api=[](){
1826
pybind11::module(pygobject_init(-1,-1,-1),false);
1927
pybind11::module api("jucpp","Python bindings for juCi++");
@@ -52,6 +60,8 @@ Python::Interpreter::Interpreter(){
5260
add_path(Config::get().python.site_packages);
5361
add_path(plugin_path);
5462
Py_Initialize();
63+
argv=Py_DecodeLocale("",&size);
64+
PySys_SetArgv(0,&argv);
5565
boost::filesystem::directory_iterator end_it;
5666
for(boost::filesystem::directory_iterator it(plugin_path);it!=end_it;it++){
5767
auto module_name=it->path().stem().string();
@@ -72,6 +82,8 @@ pybind11::module Python::Interpreter::import(const std::string &module_name){
7282
}
7383

7484
void Python::Interpreter::add_path(const boost::filesystem::path &path){
85+
if(path.empty())
86+
return;
7587
std::wstring sys_path(Py_GetPath());
7688
if(!sys_path.empty())
7789
#ifdef _WIN32

0 commit comments

Comments
 (0)