Runtime error R6034 in embedded Python application

前端 未结 13 1243
暗喜
暗喜 2020-12-04 10:06

I am working on an application which uses Boost.Python to embed the Python interpreter. This is used to run user-generated \"scripts\" which interact with the main program.<

13条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 10:46

    This post elaborates on @Micheal Cooper and @frmdstryr. Once you identified the problematic PATH entries, you can put the following in front of a python script, assuming here that iCLS Client and CMake are problematic.

    import os
    for forbidden_substring in ['iCLS Client', 'CMake']:
        os.environ['PATH'] = ';'.join([item for item in os.environ['PATH'].split(';')
                                       if not item.lower().find(forbidden_substring.lower()) >= 0])
    

    Concerning the vim with YouCompleteMe case, you can put the following at the top of your vimrc:

    python << EOF
    import os
    for forbidden_substring in ['iCLS Client', 'CMake']:
        os.environ['PATH'] = ';'.join([item for item in os.environ['PATH'].split(';')
                                       if not item.lower().find(forbidden_substring.lower()) >= 0])
    EOF
    

    If none of these solutions is applicable for you, you can try to remove the problem causing entries from you PATH manually, but you want to make sure you don't break anything else on your system that depends on these PATH entries. So, for instance, for CMake you could try to remove its PATH entry, and only put a symlink (or the like) pointing to the cmake.exe binary into some other directory that is in your PATH, to make sure cmake is still runnable from anywhere.

提交回复
热议问题