[docs] Py_SetProgramName error

Braden braden.wentworth at gmail.com
Mon Aug 19 02:09:57 CEST 2013


The Python3.3 embedding example says to use:
[
http://docs.python.org/3.3/extending/embedding.html#very-high-level-embedding
 ]

    Py_SetProgramName(argv[0]);

Which throws:

    error C2664: 'Py_SetProgramName' : cannot convert parameter 1 from
'char *' to 'wchar_t *'

To fix this someone suggested the following code
[ http://stackoverflow.com/a/18248800<http://stackoverflow.com/questions/18248343/c-python-3-binding>
 ]

    wchar_t progname[FILENAME_MAX + 1];
    mbstowcs(progname, argv[0], strlen(argv[0]) + 1);
    Py_SetProgramName(progname);

Regards,
-- 
Braden Wentworth
[ online director / code monkey ]
[ www.labvc.com.au ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130819/db6d0f76/attachment.html>


More information about the docs mailing list