在Vis上加载带有ctypes的dll时,访问被拒绝

2024-09-29 20:28:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我在使用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
>>>

你知道是什么原因导致了这种情况吗?在


Tags: inselfmostinitlinectypesfiledll
1条回答
网友
1楼 · 发布于 2024-09-29 20:28:59

我知道这听起来很傻,但既然你没有明确提到:

你检查了你要访问的文件的权限了吗?你知道,也许你对这个文件没有读或执行的权限。在

相关问题 更多 >

    热门问题