Closed McLovi9 closed 8 years ago
can you copy this attached file to overwrite your C:\python27\Lib\site-packages\unicorn\unicorn.py, then run your Python code again to see what the output is?
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information.
import unicorn
- Trying to load: C:\Python27\lib\site-packages\unicorn\libwinpthread-1.dll
- Trying to load: C:\Python27\lib\site-packages\unicorn\libgcc_s_dw2-1.dll
- Trying to load: C:\Python27\lib\site-packages\unicorn\libintl-8.dll
- Trying to load: C:\Python27\lib\site-packages\unicorn\libunicorn.so
- Trying to load: C:\Python27\lib\site-packages\unicorn\libunicorn.dylib
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libwinpthread-1.dll
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libgcc_s_dw2-1.dll
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libintl-8.dll
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libunicorn.so
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libunicorn.dylib
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
Try changing the order of the dll loading into:
_all_windows_dlls = ("libwinpthread-1.dll", "libgcc_s_seh-1.dll", "libiconv-2.dll", "libintl-8.dll","libglib-2.0-0.dll")
(located in unicorn.py line 23)
and add a (double) backslash behind the libpath on line 19
_lib_path = split(__file__)[0]+'\\'
Also: I removed "libgcc_s_dw2-1.dll" from the list because it doesnot exist in the zip or package
this mod works on win7x64
no luck, I've tested on XP I assume its the same on my win7 x64
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information.
import unicorn
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
Did you copied the line from this site or did you added the backslashes manually? Seems you are missing a underscore... Add an extra underscore behind the var _file; it should have 2 underscores as on line 17
I copied it from this site
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
copying directly from this site is not the best way to alter code... This time you are missing the start underscore on line 19; it should be _lib_path
_lib_path = split(__file__)[0]+'\\'
I edited the post with correct formatting...
import unicorn
- Trying to load: C:\Python27\lib\site-packages\unicorn\libwinpthread-1.dll
- Trying to load: C:\Python27\lib\site-packages\unicorn\libiconv-2.dll
- Trying to load: C:\Python27\lib\site-packages\unicorn\libunicorn.so
- Trying to load: C:\Python27\lib\site-packages\unicorn\libunicorn.dylib
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libwinpthread-1.dll
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libiconv-2.dll
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libunicorn.so
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libunicorn.dylib
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
stick to the proposed order of dll's:
_all_windows_dlls = ("libwinpthread-1.dll", "libgcc_s_seh-1.dll", "libiconv-2.dll", "libintl-8.dll","libglib-2.0-0.dll")
or try changing the order untils a dll loads correctly. The last successful loaded dll was libwinthread-1.dll in your case. It failed on libiconv-2.dll so its continuing with libunicorn.so
I added a print after the except line to debug which dll failed:
except OSError:
print 'error loading='+ _lib_file
pass
I do stick to the proposed order of dll _all_windows_dlls = ("libwinpthread-1.dll", "libgcc_s_seh-1.dll", "libiconv-2.dll", "libintl-8.dll","libglib-2.0-0.dll")
Adding print 'error loading='+ _lib_file did not changed anything (nothing new in the log)
@McLovi9, can you paste the output with the above DLL list?
its the same (nothing new in the log)
import unicorn
- Trying to load: C:\Python27\lib\site-packages\unicorn\libwinpthread-1.dll
- Trying to load: C:\Python27\lib\site-packages\unicorn\libiconv-2.dll
- Trying to load: C:\Python27\lib\site-packages\unicorn\libunicorn.so
- Trying to load: C:\Python27\lib\site-packages\unicorn\libunicorn.dylib
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libwinpthread-1.dll
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libiconv-2.dll
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libunicorn.so
- Trying to load: C:\Python27\Lib\site-packages\unicorn\libunicorn.dylib
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
Sadly, I cant attach my unicorn.py file.
for Win XP, can you use this order and report the result?
_all_windows_dlls = ("libwinpthread-1.dll", "libgcc_s_dw2-1.dll", "libiconv-2.dll", "libintl-8.dll","libglib-2.0-0.dll")
for Win64, can you use this order?
_all_windows_dlls = ("libwinpthread-1.dll", "libgcc_s_seh-1.dll", "libiconv-2.dll", "libintl-8.dll", "libglib-2.0-0.dll")
to keep it simple, overwrite your c:\python27\lib\site-packages\unicorn\unicorn.py
with this file https://gist.githubusercontent.com/aquynh/eb0fc442f3e7e17e5bb0/raw/748279d75dbd919bf50f2375ae7a6d847e73fd55/unicorn.py on both your Win32 XP & Win64 7 to see if it solves your problem.
wow, it seems to work! I mean import unicorn no error (tested on XP and Win7 x64). Thank you
fixed this issue in Python binding & also uploaded new Python installers with this new fix. thanks.
When executing import unicorn
, now getting ImportError
on my CentOS 6.6...
$ python
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import unicorn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/unicorn/__init__.py", line 4, in <module>
from .unicorn import Uc, uc_version, uc_arch_supported, version_bind, debug, UcError
File "/usr/lib/python2.6/site-packages/unicorn/unicorn.py", line 81, in <module>
raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.
Same error message using the maintainer's unicorn.txt
as unicorn.py
inside /usr/lib/python/site-packages/unicorn
.
Performed following command to get a feel of what Python is trying to open during this simple Python import unicorn
statement:
echo "import unicorn" > test.py
chmod a+x test.py
strace -f test.py 2>&1 | grep open | grep -v "No such file"
Output is captured here: strace-opens.log.txt
I tried "Python 2.7 module for Windows" installers and its not working out of the box.
Traceback (most recent call last): File "<pyshell#0>", line 1, in
import unicorn
File "C:\Python27\lib\site-packages\unicorninit.py", line 4, in
from unicorn import Uc, uc_version, uc_arch_supported, version_bind, debug, UcError
File "C:\Python27\lib\site-packages\unicorn\unicorn.py", line 81, in
raise ImportError("ERROR: fail to load the dynamic library.")
I've tested on 32-bit XP and 64-bit Win7 the same problem