Simple example using pbcc shown below. Make sure your exe can see the python25.dll. I'm having a problem with raw_input that doesn't allow input. Any suggestions?
Code:
#DIM ALL DECLARE SUB pyIni LIB "python25.dll" ALIAS "Py_Initialize" DECLARE SUB pyFin LIB "python25.dll" ALIAS "Py_Finalize" declare function pyRun lib "python25.dll" ALIAS "PyRun_SimpleString" (s as asciiz) as integer FUNCTION PBMAIN() STDOUT "Initiate python" pyIni pyRun("print '>>> hello from python <<<'") pyRun("import sys") pyRun("print '>>> modules: <<<'") pyRun("print sys.builtin_module_names") pyRun("print '>>> module keys: <<<'") pyRun("print sys.modules.keys()") ' PyRun("execfile('foo.py')") STDOUT "Finalize python" pyFin END FUNCTION #if 0 'Contents of foo.py name = raw_input('What is your name?\n') # \n is a newline print 'Hi', name #endif
Comment