Tkinter in PyRun_SimpleString(char* s)

Alex Martelli aleax at aleax.it
Sun Sep 15 09:39:38 CEST 2002


Torsten Mohr wrote:

> Hi,
> 
> it doesn't seem to be as easy as i thought to load a script
> from a C program and execute it, if i import Tkinter, it fails:
        ...
>   File "/usr/lib/python2.1/lib-tk/Tkinter.py", line 1476, in __init__
>     baseName = os.path.basename(sys.argv[0])
> AttributeError: 'sys' module has no attribute 'argv'

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.


Alex




More information about the Python-list mailing list