我遇到使用ctypes的问题。我正试图在Vista上运行以下项目。
http://sourceforge.net/projects/fractalfrost/
我之前在Vista上使用过这个项目并且没有任何问题。我没有看到在svn中有任何想法改变导致我认为它是这台机器本地的东西。事实上,我根本无法使用ctypes加载dll。
Bobby@Teresa-PC ~/fr0st-exe/fr0st/pyflam3/win32_dlls
$ ls
Flam4CUDA_LIB.dll cudart.dll glew32.dll libflam3.dll pthreadVC2.dll
Bobby@Teresa-PC ~/fr0st-exe/fr0st/pyflam3/win32_dlls
$ python
Python 2.6.3 (r263rc1:75186, Oct 2 2009, 20:40:30) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> flam3_dll = CDLL('libflam3.dll')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python26\lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 5] Access is denied
>>> flam3_dll = CDLL('.\\libflam3.dll')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python26\lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 5] Access is denied
>>> import os
>>> flam3_dll = CDLL(os.path.abspath('libflam3.dll'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python26\lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 5] Access is denied
>>>
任何想法会导致什么,并且更好地解决它?
答案 0 :(得分:2)
我知道这听起来很愚蠢,但是因为你没有明确提到它:
您是否检查了您尝试访问的文件的权限?您知道,也许您没有对该文件的读取或执行权限。