我对使用 python 解释器的 ac 可执行文件的 tcl 有一些问题。由于某种原因,它无法加载<fullpath>Tix843.dll
. 但是当直接(从 python)运行 python 代码时,它确实可以工作。dll的路径/名称是正确的......使用依赖walker我只看到Tkinter试图加载tix dll但找不到它......
在 tcl 中跟踪所有类型的路径后,我只能检测到 1 个差异:nameofexecutable
. 当直接从 python 运行时,它是路径,python.exe
但是当从我的 c 可执行文件运行它时,它(显然)是path/name of the executable
.
在 tcl/tk 中,我注意到nameofexecutable
用于设置很多路径,所以我认为这会导致我的问题。
我试图防止这个问题的事情:
- 将dll的路径添加到系统路径
- 将 dll 的路径添加到
$auto_path
-> 没有变化 argv[0]
在调用 PySys_SetArgv 之前设置c 可执行文件的 -> 没有变化
我在做一些愚蠢的事情还是我该如何设置nameofexecutable
?有没有其他方法可以解决这个问题。
编辑:再次检查依赖walker,现在我已经中继不知道发生了什么......这里的结果:
00:00:07.800: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/reg1.2/tclreg12.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "c:\program files (x86)\python27\dlls\TCL85.DLL" at address 0x02468871.
00:00:07.800: Loaded "c:\program files (x86)\python27\tcl\reg1.2\TCLREG12.DLL" at address 0x00440000. Successfully hooked module.
00:00:07.816: Unloaded "c:\program files (x86)\python27\tcl\reg1.2\TCLREG12.DLL" at address 0x00440000.
00:00:07.816: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/reg1.2/tclreg12.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
00:00:07.832: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/reg1.2/tclreg12.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "c:\program files (x86)\python27\dlls\TCL85.DLL" at address 0x0246889C.
00:00:07.832: Loaded "c:\program files (x86)\python27\tcl\reg1.2\TCLREG12.DLL" at address 0x00440000. Successfully hooked module.
00:00:07.832: Unloaded "c:\program files (x86)\python27\tcl\reg1.2\TCLREG12.DLL" at address 0x00440000.
00:00:07.832: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/reg1.2/tclreg12.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
00:00:07.925: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/tix8.4.3/Tix843.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "c:\program files (x86)\python27\dlls\TCL85.DLL" at address 0x02468871.
00:00:07.925: Loaded "c:\program files (x86)\python27\tcl\tix8.4.3\TIX843.DLL" at address 0x04480000. Successfully hooked module.
00:00:07.925: Unloaded "c:\program files (x86)\python27\tcl\tix8.4.3\TIX843.DLL" at address 0x04480000.
00:00:07.925: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/tix8.4.3/Tix843.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
00:00:07.941: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/tix8.4.3/Tix843.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "c:\program files (x86)\python27\dlls\TCL85.DLL" at address 0x0246889C.
00:00:07.956: Loaded "c:\program files (x86)\python27\tcl\tix8.4.3\TIX843.DLL" at address 0x04480000. Successfully hooked module.
00:00:07.956: Unloaded "c:\program files (x86)\python27\tcl\tix8.4.3\TIX843.DLL" at address 0x04480000.
00:00:07.956: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/tix8.4.3/Tix843.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
00:00:07.956: LoadLibraryA("shell32") called from "c:\program files (x86)\python27\dlls\TK85.DLL" at address 0x024BBACD.
00:00:07.956: LoadLibraryA("shell32") returned 0x75480000.
所以它可以找到 dll 有时但并不总是然后失败