Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python cx\ U Oracle和ctypes问题_Python_Ctypes_Cx Oracle - Fatal编程技术网

Python cx\ U Oracle和ctypes问题

Python cx\ U Oracle和ctypes问题,python,ctypes,cx-oracle,Python,Ctypes,Cx Oracle,交叉邮寄,但3天后未收到回复 我有一些代码可以很好地使用ctypes调用dll,除非我先运行cx\U Oracle,然后出现错误: WindowsError:[错误126]找不到指定的模块 代码示例如下所示: query = '''select * from table''' cx_Oracle.makedsn(host="host", port=1111, service_name='service.name') db_conn = cx_Oracle.connect('/@somewhere

交叉邮寄,但3天后未收到回复

我有一些代码可以很好地使用ctypes调用dll,除非我先运行cx\U Oracle,然后出现错误:

WindowsError:[错误126]找不到指定的模块

代码示例如下所示:

query = '''select * from table'''
cx_Oracle.makedsn(host="host", port=1111, service_name='service.name')
db_conn = cx_Oracle.connect('/@somewhere')
cursor = db_conn.cursor()
cursor.execute(query)
db_conn.close()

lib_path = os.path.join("C:\\Program Files (x86)\\app", "data.dll")
self.externallib = ctypes.windll.LoadLibrary(lib_path)
我正在win7上使用python 2.7.5

如果我注释掉cx_Oracle代码,它就可以正常工作,或者如果我先运行ctypes代码

任何想法都值得赞赏

贝文

编辑:
出现错误消息是因为找不到依赖项dll。我将依赖项DLL添加到路径中,问题就解决了。另一个解决方案可能是将当前目录更改为DLL的位置

是否将64位代码与32位代码混合使用?是否可以尝试在ctypes上使用哪种代码?加载依赖DLL时可能会遇到问题,这会受到更改PATH环境变量或调用的影响。可以帮助您检查问题。@erny不,据我所知,一切都是32位的。DLL是32位的,我的python enviro是32位的。@eryksun我有dependency walker,但我不确定如何使用它。我的'data.dll'正在调用许多其他dll,它们都与'data.dll'位于同一位置。因此,我怀疑,您是在暗示cx_Oracle正在更改路径或SetDllDirectory。所以,当我使用显式路径调用LoadLibrary时,它会访问“data.dll”,但却找不到依赖项?有没有关于如何修复的建议