nokia / robotframework-autoitlibrary

Other
38 stars 33 forks source link

Initializing library 'AutoItLibrary' with no arguments failed: com_error: (-2147221164, 'Class not registered', None, None) #38

Closed phil1234567891011 closed 1 month ago

phil1234567891011 commented 11 months ago

Hi,

here is how I use it:

robot --version 
Robot Framework 6.1.1 (Python 3.9.2 on win32)

install:

py -m pip install robotframework
py -m pip install robotframework-autoitlibrary

in a cmd promt as admin: regsvr32.exe *:\UserData\*******\AppData\Roaming\Python\Python39\site-packages\RobotFramework\Extensions\AutoItLibrary\AutoItX3.dll

the robot file I use:

*** Settings ***
Library    AutoItLibrary

*** Test Cases ***
Open Notepad And Write Text
    Run    some/executable/path.exe
    Win Wait Active    Untitled - VisualStudio2019
    Send    Hello, Robot Framework!

here is what I get:

Error in file '*:\*********\ui_robot_testing\test.robot' on line 2: Initializing library 'AutoItLibrary' with no arguments failed: com_error: (-2147221164, 'Class not registered', None, None)

let me know if you need more informations

lucyking commented 11 months ago

Hi @phil1234567891011 , is your OS windows 32 version?

phil1234567891011 commented 11 months ago

Hi @phil1234567891011 , is your OS windows 32 version?

Hi, Windows Server 2022 Datacenter 64 bits

lucyking commented 11 months ago
Robot Framework 6.1.1 (Python 3.9.2 on win32)

can you take a try with 64 bit python? https://www.python.org/ftp/python/3.9.2/amd64/

phil1234567891011 commented 11 months ago

how can I use another version of python ? I use the robot.exe command

lucyking commented 11 months ago

\UserData***\AppData\Roaming\Python\Python39

uninstall the 32bit \UserData\*******\AppData\Roaming\Python\Python39, then install the amd64 version.

phil1234567891011 commented 10 months ago

just checked, it seems I already use 64 bit version

Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()[0]
'64bit'
phil1234567891011 commented 10 months ago

that error messages appears a lot in google, and nobody seems to have a solution for this while it is so easy to reproduce

lucyking commented 10 months ago

it looks abnormal. I'll check further.

DanielDellAgnolo commented 8 months ago

@lucyking Hi, do you have a solution? I have the same case I try to import

with this import: Library AutoItLibrary

I have this error: Initializing library 'AutoItLibrary' with no arguments failed: com_error: (-2147221164, ' Unregistered class', None, None)

phil1234567891011 commented 7 months ago

as for me I use pywinauto and win32gui, I gave up on this a while ago

joel-bgl commented 6 months ago

I've go the same issue. Strangely when I install robotframework.autoitlibrary it install the 32bits library instead of the 64bits. To fix it manually you can do this workaround : unzip the package robotframework-autoitlibrary-1.2.8 (for instance), you will find a folder 3rdPartyTools\AutoIt\lib64 where there is the dll AutoItX3.dll.

-> unregister the 32bits DLL : regsvr32.exe /U "your library location\site-packages\RobotFramework\Extensions\AutoItLibrary\AutoItX3.dll"

-> copy AutoItX3.dll into your library location\site-packages\RobotFramework\Extensions\AutoItLibrary\AutoItX3.dll

-> register the 64bits DLL : regsvr32.exe "your library location\site-packages\RobotFramework\Extensions\AutoItLibrary\AutoItX3.dll"

phil1234567891011 commented 6 months ago

gave up on this a long time ago, nobody is looking at it anyway

lucyking commented 5 months ago

@joel-bgl many thanks for your debug info. @phil1234567891011 I will try to fix this issue asap.

jjdenhup commented 2 months ago

still seeing this issue

@joel-bgl many thanks for your debug info. @phil1234567891011 I will try to fix this issue asap.

fyi, still seeing this issue

lucyking commented 2 months ago

Hi @jjdenhup, Could you kindly help to share the py -m pip install robotframework-autoitlibrary full output log?

jjdenhup commented 2 months ago

Sure. Not much there though.

D:\repos>py -m pip install robotframework-autoitlibrary Collecting robotframework-autoitlibrary Using cached robotframework_autoitlibrary-1.2.8-py3-none-any.whl Requirement already satisfied: pywin32 in c:\python312\lib\site-packages (from robotframework-autoitlibrary) (306) Requirement already satisfied: pillow in c:\python312\lib\site-packages (from robotframework-autoitlibrary) (10.4.0) Installing collected packages: robotframework-autoitlibrary Successfully installed robotframework-autoitlibrary-1.2.8 D:\repos>

Note that the workaround in #31 does work. If i clone the repo and run the script from there, it is successful. https://github.com/nokia/robotframework-autoitlibrary/issues/31#issuecomment-864686955

jjdenhup commented 1 month ago

I started digging and figured out a few things but not enough for a PR, so I thought i'd share.

and then change (get_python_lib() to get_path('platlib')


- But I have not figured out what the proper changes are in setup.py to get the custom actions to be called in the pip install
jjdenhup commented 1 month ago

I created a PR with changes that work on latest versions of Python. Let me know if you have questions.

joel-bgl commented 1 month ago

Hello @lucyking , when the fix will be available on pypi.org ? I still see the version from January 2022. Thank you. Joel

lucyking commented 1 month ago

hi @joel-bgl, v1.2.9 released now.

lucyking commented 1 month ago

fix by v1.2.9