manykarim / robotframework-doctestlibrary

Robot Framework DocTest library. Simple Automated Visual Document Testing.
Apache License 2.0
46 stars 20 forks source link

Can't import DocTest.VisualTest library #11

Closed TSavin closed 3 years ago

TSavin commented 3 years ago

Hi,

I've installed and used doctestlibrary on my personal computer and everything works fine. But after installing everything needed on another laptop, when i try to import DocTest.VisualTest library, it failed. Only this part of doctestlibrary : import of DocTest.PdfTest is ok and works . I've tried on python 3.7 and 3.9 also with same result.

DocTestLibraryJPG

Here is the error i get when i run it :

Importing library 'DocTest.VisualTest' failed: FileNotFoundError: Could not find module 'c:\python\lib\site-packages\pylibdmtx\libdmtx-64.dll' (or one of its dependencies). Try using the full path with constructor syntax. Traceback (most recent call last): File "c:\python\lib\site-packages\DocTest\VisualTest.py", line 1, in from DocTest.CompareImage import CompareImage File "c:\python\lib\site-packages\DocTest\CompareImage.py", line 19, in from pylibdmtx import pylibdmtx File "c:\python\lib\site-packages\pylibdmtx\pylibdmtx.py", line 10, in from .wrapper import ( File "c:\python\lib\site-packages\pylibdmtx\wrapper.py", line 70, in _dmtxVersion = libdmtx_function('dmtxVersion', c_char_p) File "c:\python\lib\site-packages\pylibdmtx\wrapper.py", line 58, in libdmtx_function return prototype((fname, load_libdmtx())) File "c:\python\lib\site-packages\pylibdmtx\wrapper.py", line 39, in load_libdmtx LIBDMTX = dmtx_library.load() File "c:\python\lib\site-packages\pylibdmtx\dmtx_library.py", line 40, in load libdmtx = cdll.LoadLibrary( File "c:\python\lib\ctypes__init__.py", line 452, in LoadLibrary return self._dlltype(name) File "c:\python\lib\ctypes__init.py", line 374, in init__ self._handle = _dlopen(self._name, mode) PYTHONPATH: C:\Python\Scripts\robot.exe C:\Python37 c:\python\python39.zip c:\python\DLLs c:\python\lib c:\python c:\python\lib\site-packages c:\python\lib\site-packages\win32 c:\python\lib\site-packages\win32\lib c:\python\lib\site-packages\Pythonwin C:\Python\lib\site-packages\robotide\contrib\testrunner../../lib

manykarim commented 3 years ago

Hi Tony, this seems to be caused by the missing "libdmtx-64.dll". This .dll is normally installed automatically, when pylibdmtx package is installed as a dependency. That problem occured to me, when installing the library via python setup.py install.

Two little things I would ask you to try: a) Install the robotframework-doctestlibrary via pip (and maybe force a reinstall) pip install --upgrade --force-reinstall robotframework-doctestlibrary b) Install pylibdmtx separately via pip pip install pylibdmtx

BR, Many

TSavin commented 3 years ago

Hi Many,

Thanks for your answer . I've check, and libdmtx-64.dll is at the right place. I've tried to uninstall / reinstall both of them without any success on python 3.9.2.

I'm trying to reinstall python 3.7.9 64 bit and all libraries because i've seen that libdmtx where not tested on python 3.9.

Fun fact, on my desktop, where the lib runs well, i don't have this directory : c:\python\lib\site-packages\DocTest\ ?

manykarim commented 3 years ago

I have the feeling that it is not related to python 3.9.X. So, the library libdmtx-64.dll is available in "c:\python\lib\site-packages\pylibdmtx\libdmtx-64.dll" but you still get that error message?

Maybe it is also related to a problem mentioned in the pylibdmtx project page: https://github.com/NaturalHistoryMuseum/pylibdmtx/#windows-error-message

Windows error message If you see an ugly ImportError when importing pylibdmtx on Windows you will most likely need the Visual C++ Redistributable Packages for Visual Studio 2013. Install vcredist_x64.exe if using 64-bit Python, vcredist_x86.exe if using 32-bit Python.

Or have you checked if the .dll is blocked for some reason? Just open the properties of the .dll file in Windows Explorer and check if it is maybe blocker. If yes, unblock it.

manykarim commented 3 years ago

Such an annoying .dll. It's in fact only needed to find data matrices, so it's only a rare use case anyway. Guess I should remove it from the "default" doctest library in the future...

TSavin commented 3 years ago

Many,

I've tried again on Python 3.7.9 - 64 bit- Reinstall all librairies. I've add also in system path the python directory: c:\Users****\AppData\Roaming\Python\Scripts. I don't have "c:\python\lib\site-packages\pylibdmtx\libdmtx-64.dll" error anymore but still can't add DocTest.VisualTest.

I'll try to install Visual C++ as mentionned.

manykarim commented 3 years ago

ok, weird. Thanks a lot for trying it out. What error do you get now?

TSavin commented 3 years ago

It just doesn't find this part of lib. DocTest.PdfTest is still running fine. dll files seems to be ok. I'm installing VC++ and reboot.

manykarim commented 3 years ago

By the way: If I see it correctly, you are not using a Virtual Python Environment, right?

And how did you instal the doctestlibrary on your system? Via pip? pip install robotframework-doctestlibrary

TSavin commented 3 years ago

Ok, it looks like you were right with VC++ ! Once i installed it and reboot, it works. Maybe you should add a comment on your installation tutorial ?

Thanks for helping and for your lib Many ;)

manykarim commented 3 years ago

wow, awesome. I will definitely add the comment to my documentation. Thanks a lot for trying it out!!

TSavin commented 3 years ago

I'll try to test it with python 3.9.2 - 64 bit.

EDIT : It works also on 3.9

manykarim commented 3 years ago

README.md has been updated.