Tkinter in PyRun_SimpleString(char* s)

Alex Martelli aleax at
Sun Sep 15 12:59:12 EDT 2002

Torsten Mohr wrote:

> Hi,
> thanks for that hint.
>> As you can see, the problem is with sys.argv, which you have
>> not set.  You can set it up from the Python code you execute,
>> before you import Tkinter, or with C-API call PySys_SetArgv.

...which needs to be called AFTER Py_Initialize -- I think that
may be your problem:

> /* C code */
>         Py_SetProgramName(argv[0]);
>         PySys_SetArgv(argc, argv);
>         Py_Initialize();
>         PyRun_SimpleString(script);
>         Py_Finalize();

Try switching the 2nd and 3rd ones of these five calls.


More information about the Python-list mailing list