pynetwork / pypcap

pypcap - python libpcap module, forked from code.google.com/p/pypcap
Other
299 stars 74 forks source link

ImportError: DLL load failed #50

Closed starsyiyi closed 7 years ago

starsyiyi commented 7 years ago

with ver 1.16, i have successful finished setup, but print 'import pcap' have a issue:

import pcap

Traceback (most recent call last): File "<pyshell#0>", line 1, in import pcap ImportError: DLL load failed: no mould

starsyiyi commented 7 years ago

btw python ver is 2.7

hellais commented 7 years ago

It seems like the output it truncated at "modul". Can you paste the full output?

cart587 commented 7 years ago

I got the same error:

Traceback (most recent call last): File "viewer.py", line 2, in import pcap File "build\bdist.win-amd64\egg\pcap.py", line 7, in File "build\bdist.win-amd64\egg\pcap.py", line 6, in bootstrap ImportError: DLL load failed: The specified module could not be found.

starsyiyi commented 7 years ago

hi,pls check the following full trace, also i try load other mould -ex 'a', but error-info is different,thanks

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information.

import pcap

Traceback (most recent call last): File "<pyshell#0>", line 1, in import pcap ImportError: DLL load failed: The specified module could not be found.

import a

Traceback (most recent call last): File "<pyshell#1>", line 1, in import a ImportError: No module named a

starsyiyi commented 7 years ago

the following is setup trace ,thanks so much please ignores quare characters :)

D:\Users\xw>cd D:\Users\xw\Desktop\pypcap-feature-1.1.6

D:\Users\xw\Desktop\pypcap-feature-1.1.6>dir 驱动器 D 中的卷是 PersistentDataDisk 卷的序列号是 5E1B-0C3F

D:\Users\xw\Desktop\pypcap-feature-1.1.6 的目录

2017/05/04 17:21

. 2017/05/04 17:21 .. 2017/04/17 02:11 35 .gitignore 2017/04/17 02:11 618 .travis.yml 2017/04/17 02:11 68 AUTHORS 2017/04/17 02:11 1,258 Changelog.md 2017/05/04 17:21 docs 2017/04/17 02:11 1,431 LICENSE 2017/04/17 02:11 644 Makefile 2017/04/17 02:11 37 MANIFEST.in 2017/04/17 02:11 308,627 pcap.c 2017/04/17 02:11 14,230 pcap.pyx 2017/04/17 02:11 6,512 pcap_ex.c 2017/04/17 02:11 636 pcap_ex.h 2017/04/17 02:11 2,251 README.rst 2017/04/17 02:11 326 setup.cfg 2017/04/17 02:11 3,864 setup.py 2017/05/04 17:21 tests 2017/04/17 02:11 579 tox.ini 15 个文件 341,116 字节 4 个目录 836,255,744 可用字节

D:\Users\xw\Desktop\pypcap-feature-1.1.6>python setup.py install Found pcap headers in C:\Python27\include\pcap.h Found libraries in C:\Python27\lib\wpcap.lib running install running bdist_egg running egg_info creating pypcap.egg-info writing pypcap.egg-info\PKG-INFO writing top-level names to pypcap.egg-info\top_level.txt writing dependency_links to pypcap.egg-info\dependency_links.txt writing manifest file 'pypcap.egg-info\SOURCES.txt' reading manifest file 'pypcap.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'pypcap.egg-info\SOURCES.txt' installing library code to build\bdist.win32\egg running install_lib running build_ext building 'pcap' extension creating build creating build\temp.win32-2.7 creating build\temp.win32-2.7\Release C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD / W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\include -IC:\Python27\PC /T cpcap.c /Fobuild\temp.win32-2.7\Release\pcap.obj -DWIN32 -DWPCAP pcap.c pcap.c(3520) : warning C4090: “函数”: 不同的“const”限定符 pcap.c(3520) : warning C4028: 形参 2 与声明不同 pcap.c(3520) : warning C4028: 形参 3 与声明不同 C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD / W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\include -IC:\Python27\PC /T cpcap_ex.c /Fobuild\temp.win32-2.7\Release\pcap_ex.obj -DWIN32 -DWPCAP pcap_ex.c pcap_ex.c(77) : warning C4996: 'sscanf': This function or variable may be unsafe . Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WA RNINGS. See online help for details. C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\stdio.h(325) : 参见“sscanf”的声明 pcap_ex.c(82) : warning C4996: 'strncpy': This function or variable may be unsaf e. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURENO WARNINGS. See online help for details. C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\string.h(188) : 参见“strncpy”的声明 pcap_ex.c(141) : warning C4996: 'sprintf': This function or variable may be unsa fe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO _WARNINGS. See online help for details. C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\stdio.h(371) : 参见“sprintf”的声明 pcap_ex.c(293) : warning C4996: 'mktemp': The POSIX name for this item is deprec ated. Instead, use the ISO C++ conformant name: _mktemp. See online help for det ails. C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\io.h(311) : 参 见“mktemp”的声明 pcap_ex.c(294) : warning C4996: 'fopen': This function or variable may be unsafe . Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WAR NINGS. See online help for details. C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\stdio.h(234) : 参见“fopen”的声明 pcap_ex.c(309) : warning C4996: 'unlink': The POSIX name for this item is deprec ated. Instead, use the ISO C++ conformant name: _unlink. See online help for det ails. C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\io.h(212) : 参 见“unlink”的声明 creating build\lib.win32-2.7 C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo /INCR EMENTAL:NO /LIBPATH:C:\Python27\lib /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python 27\PCbuild /LIBPATH:C:\Python27\PC\VS9.0 wpcap.lib iphlpapi.lib /EXPORT:initpcap build\temp.win32-2.7\Release\pcap.obj build\temp.win32-2.7\Release\pcap_ex.obj /OUT:build\lib.win32-2.7\pcap.pyd /IMPLIB:build\temp.win32-2.7\Release\pcap.lib /MANIFESTFILE:build\temp.win32-2.7\Release\pcap.pyd.manifest 正在创建库 build\temp.win32-2.7\Release\pcap.lib 和对象 build\temp.win32-2.7\ Release\pcap.exp creating build\bdist.win32 creating build\bdist.win32\egg copying build\lib.win32-2.7\pcap.pyd -> build\bdist.win32\egg creating stub loader for pcap.pyd byte-compiling build\bdist.win32\egg\pcap.py to pcap.pyc creating build\bdist.win32\egg\EGG-INFO copying pypcap.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO copying pypcap.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO copying pypcap.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO copying pypcap.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO writing build\bdist.win32\egg\EGG-INFO\native_libs.txt zip_safe flag not set; analyzing archive contents... creating dist creating 'dist\pypcap-1.1.6.dev0-py2.7-win32.egg' and adding 'build\bdist.win32\ egg' to it removing 'build\bdist.win32\egg' (and everything under it) Processing pypcap-1.1.6.dev0-py2.7-win32.egg Copying pypcap-1.1.6.dev0-py2.7-win32.egg to c:\python27\lib\site-packages Removing pypcap 1.1.6 from easy-install.pth file Adding pypcap 1.1.6.dev0 to easy-install.pth file

Installed c:\python27\lib\site-packages\pypcap-1.1.6.dev0-py2.7-win32.egg Processing dependencies for pypcap==1.1.6.dev0 Finished processing dependencies for pypcap==1.1.6.dev0

D:\Users\xw\Desktop\pypcap-feature-1.1.6>

hellais commented 7 years ago

Thanks for the detailed bug reports. Is this something that started happening since 1.1.6? Was 1.1.5 working for you? Unfortunately my windows knowledge is very limited and I don't have a working windows system at the moment. @nuald do you have any ideas as to what may be happening here?

nuald commented 7 years ago

I've seen this error if Npcap installed without WinPcap-compatible mode (it has DLL in a different location): #48. We don't support both Npcap modes yet, so I'd recommend to reinstall Npcap with the WinPcap-compatible mode.

P. S. Nothing wrong with the Python package here, the referenced message is about missing DLL used by the package's native code.

starsyiyi commented 7 years ago

@nuald thanks so much. uninstall winpcap 4.1.3 and re-install winpcap4.1.2 ,it is normal now.

starsyiyi commented 7 years ago

uninstall winpcap 4.1.3 and re-install winpcap4.1.2 ,it is normal now.