caller process hangs

Dominik Reiter reidom1 at yahoo.com
Fri Dec 8 09:14:36 EST 2000


Hi everybody,

I have embedded python into a C program. From there I
have to call a python - script. Unfortunately,
whenever I do this, the script starts to run, but the
C programm hangs until the script is finished. I need
to have access to both programs at the same time. Is
there any way to do this. I'm running on a SGI machine
with python 1.6 (necessary). The code for the C
program looks like this (shortened):

#include	<aptypes.h>
#include	<appublic.h>
#include	<uipublic.h>
#include	<uierr.h>
#include        <Python.h>
#include        <config.c>

#ifdef R_ROUTINE
#undef R_ROUTINE
#endif

#define	R_ROUTINE	"main"

main (argc,argv)
int	argc ;
char	**argv ;

{
	char	*app_name = "vlo"; 
	char	*rsrc_name = "vlo"; 
	char	*top_menu  = "menu";

Py_SetProgramName(argv[0]);
Py_Initialize();
PyRun_SimpleString("import vlorob");

#undef	R_ROUTINE

and here's the code for the script, which itself calls
a pythonprogram:

import os, string

# set v for Module-directory
v = 'mod'
# set s for startupfile
s = 'somefile.py'

a = os.environ['PYTHONPATH']
b = string.split(a, ':')
for i in b:
	if i[-3:] == 'lib':
		if string.find(i, v) > 0:
			c = i
d = os.path.join(c, s)
os.system('python ' + d)

I've tried to do something with threads, or call a new
Shell, but to no effect.

Any help on this is greatly appreciated

Dominik

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/




More information about the Python-list mailing list