python - 在 Vista 上使用 ctypes 加载 dll 时访问被拒绝

标签 python windows-vista ctypes

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

有什么想法会导致这个问题以及更好的解决办法吗?

最佳答案

我知道这听起来很愚蠢,但由于您没有明确提及:

您是否检查过您尝试访问的文件的权限?也许您没有该文件的读取或执行权限。

关于python - 在 Vista 上使用 ctypes 加载 dll 时访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1533466/

相关文章:

python - PyMongo 插入具有约 100M 记录的极其缓慢的数据库

python - 如何使用Python中的socks模块下载网页?

python - 结构定义中带有指针的枚举

Python ctypes.string_at 释放行为

python - 在另一个模板中显示来自 Django View 的 HTML 表格

python - 如何在 python 中去除文件中文本中的\n,然后计算文本中包含超过 n 个字母的单词?

Windows 冗余交换?

asp.net - 由于 Windows Vista Home Premium 版本缺少 Windows 身份验证 IIS 组件...有修复吗?

c# - 为什么 RequestAdditionalTime() 方法在 Vista/7 中重启时不起作用?

python - Ctypes linux 行为在 py2 和 py3 上不同