Runtime error R6034 in embedded Python application

前端 未结 13 1194
暗喜
暗喜 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:38

    This post elaborates on @Micheal Cooper and @frmdstryr and gives a better alternative than my earlier answer. You can put the following in front of a python script to purge the problematic entries.

    import os, re
    path = os.environ['PATH'].split(';')
    
    def is_problem(folder):
        try:
            for item in os.listdir(folder):
                if re.match(r'msvcr\d\d\.dll', item):
                    return True
        except:
            pass
        return False
    
    path = [folder for folder in path if not is_problem(folder)]
    os.environ['PATH'] = ';'.join(path)
    

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

    python << EOF
    import os, re
    path = os.environ['PATH'].split(';')
    
    def is_problem(folder):
        try:
            for item in os.listdir(folder):
                if re.match(r'msvcr\d\d\.dll', item):
                    return True
        except:
            pass
        return False
    
    path = [folder for folder in path if not is_problem(folder)]
    os.environ['PATH'] = ';'.join(path)
    EOF
    
    0 讨论(0)
  • 2020-12-04 10:38

    Adding this answer for who is still looking for a solution. ESRI released a patch for this error. Just download the patch from their website (no login required), install it and it will solve the problem. I downloaded the patch for 10.4.1 but there are maybe patches for other versions also.

    0 讨论(0)
  • 2020-12-04 10:39

    In my case the rebuilding of linked libraries and the main project with similar "Runtime execution libraries" project setting helped. Hope that will be usefull for anybody.

    0 讨论(0)
  • 2020-12-04 10:39

    The discussion on this page involves doing things way far advanced above me. (I don't code.) Nevertheless, I ran Process Explorer as the recommended diagnostic. I found that another program uses and needs msvcr90.dll in it's program folder. Not understanding anything else being discussed here, as a wild guess I temporarily moved the dll to a neighboring program folder.

    Problem solved. End of Runtime error message.

    (I moved the dll back when I was finished with the program generating the error message.)

    Thank you all for your help and ideas.

    0 讨论(0)
  • 2020-12-04 10:41

    I also had the same problem with embedding Python27.dll from a C-program using the Universal-CRT.

    A <PYTHON_ROOT>\msvcr90.dll was the offender. And <PYTHON_ROOT> is off-course in my PATH. AFAICS the only users of msvcr90.dll are the PyWin32 modules <PYTHON_ROOT>\lib\site-packages\win32\win32*.pyd.

    The fix was just move <PYTHON_ROOT>\msvcr90.dll to that directory.

    PS. PyWin32 still has this as an issue 7 years later!

    0 讨论(0)
  • 2020-12-04 10:42

    Check any library having user specified path by Process Explorer. It is not necessary must be msvcr??.dll I solved same problem except I run Python 3. Present solutions not helped because they not indicate unusual paths of msvcr90.dll. I debug code step by step inside till error dialog appears after rows (called when my code was importing PyTables module):

    import ctypes
    ctypes.cdll.LoadLibrary('libbz2.dll')
    

    Then Process Explorer helps to find path to old libbz2.dll caused the problem (steps 3, 4 of @Micheal Cooper algorithm)

    0 讨论(0)
提交回复
热议问题