]>
Dogcows Code - chaz/openbox/blob - src/python.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
8 #include "otk/display.hh"
17 void python_init(char *argv0
)
19 // start the python engine
20 Py_SetProgramName(argv0
);
22 // prepend the openbox directories for python scripts to the sys path
23 PyRun_SimpleString("import sys");
24 PyRun_SimpleString("sys.path.insert(0, '" SCRIPTDIR
"')");
25 PyRun_SimpleString(const_cast<char*>(("sys.path.insert(0, '" +
26 otk::expandTilde("~/.openbox/python") +
35 bool python_exec(const std::string
&path
)
37 FILE *rcpyfd
= fopen(path
.c_str(), "r");
39 printf("Failed to load python file %s\n", path
.c_str());
42 PyRun_SimpleFile(rcpyfd
, const_cast<char*>(path
.c_str()));
This page took 0.045131 seconds and 5 git commands to generate.