Closed Harm10 closed 2 years ago
@Harm10 Do you run pip install robotframework-autoitlibrary
and RIDE with administrative privilege?
If you mean that I used administrative level on command box then the answer is yes. I do not have Run as administrator for py files. I am running on my own W10 machine.
I uninstalled and installed Autoitlibrary again to get the same messages when Activating the library:
Initializing test library 'AutoItLibrary' with no arguments failed: com_error: (-2147221164, 'Klasse is niet geregistreerd', None, None) Traceback (most recent call last): File "D:\Program Files\Python\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 167, in _get_instance return libcode(*self.positional_args, **dict(self.named_args)) File "D:\Program Files\Python\lib\site-packages\AutoItLibrary\__init__.py", line 91, in __init__ self._AutoIt = win32com.client.Dispatch("AutoItX3.Control") File "D:\Program Files\Python\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "D:\Program Files\Python\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "D:\Program Files\Python\lib\site-packages\win32com\client\dynamic.py", line 83, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) File "D:\Program Files\Python\lib\site-packages\robotide\spec\librarymanager.py", line 82, in _fetch_keywords return get_import_result(path, library_args) File "D:\Program Files\Python\lib\site-packages\robotide\spec\libraryfetcher.py", line 21, in get_import_result lib = robotapi.TestLibrary(path, args) File "D:\Program Files\Python\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 54, in TestLibrary lib.create_handlers() File "D:\Program Files\Python\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 100, in create_handlers self._create_handlers(self.get_instance()) File "D:\Program Files\Python\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 159, in get_instance self._libinst = self._get_instance(self._libcode) File "D:\Program Files\Python\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 169, in _get_instance self._raise_creating_instance_failed() File "D:\Program Files\Python\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 314, in _raise_creating_instance_failed % (self.name, args_text, msg, details))
File "D:\Program Files\Python\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 314, in _raise_creating_instance_failed % (self.name, args_text, msg, details))
it seems more like one robotide issue.
So I need to report this on RIDE support?
RIDE support is looking at it and have the feeling that this is a package problem. My Python is installed on my D disc. So when installing your package I do not get C:\RobotFramework\Extensions\AutoItLibrary but it is created as D:\Program Files\Python\Lib\site-packages\RobotFramework\Extensions\AutoItLibrary. If RIDE support registers the AutoItX3.dll on the C location the package works. Registering the dll from another place the error gets thrown. See https://github.com/robotframework/RIDE/issues/2374
Can you please reopen this issue?
This might be relevant. If I do command "where python" I get
D:\Program Files\Python\python.exe C:\Users\Harm\AppData\Local\Microsoft\WindowsApps\python.exe
I installed Python on D disc. So what's this C reference about?
@Harm10 It seems a bug. I'm gonna fix it in next step.
@lucyking Can you give me some plan on when the bug will be fixed and I can test again?
@Harm10 I fireup one win10 64bit OS in virtualbox and install the SW (RIDE (2.0b1) on Python 3.7.9 and RF 3.2.2) by pip cmd. Then the robotframework-autoitlibrary also can be installed and work well. BTW, pls let me know if your OS is 32bit.
Here's my suggestion:
C:\Users\Harm\AppData\Local\Microsoft\WindowsApps\python.exe
and take a try once more.C:\Users\Administrator>D: D:>\ pip install robotframework-autoitlibrary
Thanks for your response. I am on Win10-64bits. I uninstalled and reinstalled autoitlibrary from D. All files are again on D disc (like described earlier)
I cannot reinstall the python on C as I do not know to what it belongs too. So too much risk in my view. The file size of that file is 0 Kb. I cannot delete or rename it. There is also a 0 Kb python3.exe there (and a skype.exe of 0 Kb). So inactive programs if you ask me.
Anyway you can have several Python installs on a Windows machine so that should not make any difference for RF. As RIDE states it is running on Python 3.7.9. I have RF 4.0.2 so that is higher than you have.
BTW did you read the analysis of the dll registration on the RIDE issue I opened for this problem?
Hi @Harm10, I've took a glance of https://github.com/robotframework/RIDE/issues/2374. Further investigation shows it's a Windows user account privilege issue indeed[2].
If you mean that I used administrative level on command box then the answer is yes.
Even though you have run pip install cmd in admin mode. But in fact your account still have no admin privileges[1], so you need ask IT help to fix this issue. ( or add your account to Administrator Group if they cannot fix at last 😹
One worse thing is that the \S
option of cmd = r"%SYSTEMROOT%\system32\regsvr32.exe /S " + '\"' + instFile + '\"'
in setup.py#L73 suppress the ERR promote. I will fix it sooner.
[1] run below cmd in PowerShell to check if you do have admin privilege when "run as Administartor".
$elevated = ([Security.Principal.WindowsPrincipal] ` [Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) echo $elevated
[2] test details: run
%SYSTEMROOT%\system32\regsvr32.exe "C:\Python39\Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll"
manually in
User account "run as Administartor" but without admin privilege indeed:
User account which does with admin privilege:
As issue #1, on general if run pip install robotframework-autoitlibrary
not in an elevated command prompt , will meet:
subprocess.CalledProcessError: Command '%SYSTEMROOT%\system32\regsvr32.exe / S c:\python27\Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll' returned non-zer o exit status 5
The testing I am doing is on a personal Windows machine which is not part of any company network whatsoever. My command box is in admin mode always (I have created it that way). So I have highest rights on my own machine.
Have you experimented yourself on a machine that has both C and D drive (with Python installed on D drive)? Because I have the feeling the problem has to do with that.
@Harm10
Got it. My test win10 has both C and D drive indeed.
To narrow issue scope, could you kindly tell what below script output in PowerShell?
$elevated = ([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
echo $elevated
Output is "True"
BTW Found the reason of those weird 0 bytes files in that location. Read this post https://superuser.com/questions/1437590/typing-python-on-windows-10-version-1903-command-prompt-opens-microsoft-stor When switched off in the Windows settings those files disappear and where python only gives the one true location.
Reported problem persists though...........
@Harm10 So the key point is that when running %SYSTEMROOT%\system32\regsvr32.exe "C:\Python39\Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll"
manually in in an elevated command prompt still failed?
My Python installation is on D. I find AutoIt in D:\Program Files\Python\Lib\site-packages\AutoItLibrary. But there is no folder called lib below that and no dll to be found. So apparently when installing the dll ends up elsewhere? I searched for the dll and found it in D:\Program Files\Python\Lib\site-packages\RobotFramework\Extensions\AutoItLibrary. So why is this? Shouldn't they be "together"?
BTW I also found this dll in D:\Program Files\AutoIt3\AutoItX. This is from the separate AutoIt install.
D:\Program Files\Python\Lib\site-packages\RobotFramework\Extensions\AutoItLibrary.
setup.py#L93 destPath = os.path.normpath(os.path.join(os.getenv("HOMEDRIVE"), r"\RobotFramework\Extensions\AutoItLibrary"))
will try to find out the home drive disk, such as C:\ or D:\, etc. ~But on your it returns "D:\Program Files\Python\Lib\site-packages\". Could you check why?~
BTW I also found this dll in D:\Program Files\AutoIt3\AutoItX.
The robotframework-autoitlibrary reuses AutiItX's dll, it doesn't matter.
If i just do command os.getenv("HOMEDRIVE") in Python it returns C: os.name = 'nt' get_python_lib() gives me 'D:\Program Files\Python\Lib\site-packages'
When looking at this part of the code:
instDir = os.path.normpath(os.path.join(get_python_lib(), "AutoItLibrary/lib")) if not os.path.isdir(instDir) : os.makedirs(instDir) instFile = os.path.normpath(os.path.join(instDir, "AutoItX3.dll"))
As I get false on os.path.isdir(instDir) the folder instDir should be created and it isn't. So why is that?
If i just do command os.getenv("HOMEDRIVE") in Python it returns C: os.name = 'nt' get_python_lib() gives me 'D:\Program Files\Python\Lib\site-packages'
When looking at this part of the code:
instDir = os.path.normpath(os.path.join(get_python_lib(), "AutoItLibrary/lib")) if not os.path.isdir(instDir) : os.makedirs(instDir) instFile = os.path.normpath(os.path.join(instDir, "AutoItX3.dll"))
As I get false on os.path.isdir(instDir) the folder instDir should be created and it isn't. So why is that?
Could you run python steup.py install
and paste the full output log?
python setup.py install from which folder?
Perhaps I can be of some help.
As posted at RIDE
regsvr32.exe "D:\Program Files\Python\Lib\site-packages\RobotFramework\Extensions\AutoItLibrary\AutoItX3.dll"
That path is considered the 32 bit AutoItX3.dll if you look at the repository structure. Though, how it got there with this code
destPath = os.path.normpath(os.path.join(os.getenv("HOMEDRIVE"), r"\RobotFramework\Extensions\AutoItLibrary"))
in setup.py is strange. Some magic I do not know about.
See in AutoIt folder. AutoItX3.dll in the root dir, is the 32 bit DLL. The lib64\AutoItX3.dll
has the 64 bit DLL.
To check the DLL, Open notepad and drag'n'drop the DLL on the edit control. Look for This program cannot be run in DOS mode.
, then look below at the 2nd line a little to the right several characters to find PE
, then a few more characters right will show either L
for 32 bit or d
for 64 bit. I see L
for the DLL downloaded from the repository. The size is different too as 310KB (32 bit) vs 503KB (64 bit).
If you have 64 bit Python and register the 32 bit DLL, Python will fail if 64 bit DLL is not registered. Even if 64 bit Python tried to load the 32 bit DLL, it would fail. It needs to be the same bitness.
Try to register this 64 bit DLL.
Check the registration with this command in CMD:
reg query HKLM\SOFTWARE\Classes\TypeLib\{F8937E53-D444-4E71-9275-35B64210CC3B} /s
If a key ends with \win32
, 32 bit is registered. If a key ends with \win64
, 64 bit is registered. You can have both registered at once.
D:\Program Files\Python\Lib\site-packages\AutoItLibrary\lib
not being created may need some investigation. It is strange and I would not want to guess.
@Harm10 please paste the full output of below cmd:
git clone https://github.com/nokia/robotframework-autoitlibrary.git
cd robotframework-autoitlibrary
python steup.py install
python
@mpheath The setup.py#L64 will check which 32/64 bitness python installed. Here's all the cases:
win OS | python | autoit DLL |
---|---|---|
32 | 32 | 32 |
64 | 32 | 32 |
64 | 64 | 64 |
As I do not have git itself installed I get: 'git' is not recognized as an internal or external command, Should I install git?
Can I issue a git clone command from any directory or do I need to go to the folder that holds python?
And I assume it needs to be python setup.py install and not python steup.py install?
@Harm10 if so you can download the robotframework-autoitlibrary-master.zip and unzip it to any folder. Then run above cmds in the folder.
I assume I first have to uninstall robotframework-autoitlibrary with pip uninstall? And are there other dependent packages I need to uninstall?
@Harm10 No need, just unzip, enter the folder and run cmd directly. BTW, pls delete '\S' in setup.py #L73 , then we can get verbose debug info.
Getting error:
Traceback (most recent call last): File "D:\RobotFramework\#temp\robotframework-autoitlibrary-master\robotframework-autoitlibrary-master\setup.py", line 68, in <module> shutil.copyfile("3rdPartyTools/AutoIt/lib64/AutoItX3.dll", instFile) File "D:\Program Files\Python\lib\shutil.py", line 120, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: '3rdPartyTools/AutoIt/lib64/AutoItX3.dll'
@Harm10 there, could you install one TeamView software? then let's remote lively debug on your PC?
I have Teamviewer installed, also a Skype account. I am in Europe (Amsterdam time). And you? Perhaps not share account info in here?
@Harm10 pls share your account info to my email joehisaishi1943@gmail.com.
Send a mail
So I agreed to show my system for a live debug. This was last Saturday and no one showed up. I waited for over an half an hour! Not hard to imagine that I was not happy about that. So I decided to leave this package for what it is and uninstalled it.
Some thoughts still: why does this package needs to register a dll that is also contained in the normal AutoIt software? After all this software is used by this package or not?
Please update your documentation on GitHub as there are several errors in there!
Also take care of your tests. It contains execution with pybot and not everyone is using that (I don't for example).
I am still willing to test any new version but obviously will no longer open up my system for a live debug!
I have been stuck on this issue since several months since I got the new laptop of same type through the AT&T corporate lease roll . I have two laptops in front of me. Same versions of Robot framework, AutoIT and other packages except old one having pyhon 3.9 an dnew on having python 3.0.
The Diagnostics code that you provided at the setup.py , RegSvr32 etc. They both give same errors. However the AutoIT runs on the old laptop and does not encounter the initialization issue on latop. So this may give an opportunity to compare the two and denug.
You may share my contact infor with Harm10 and other. I am available any time to do webex and share the desktop, Thank you very much Tushar Shah Ts7237@att.com
@Harm10 @TusharInTech Please install the newest v1.2.8 to check if issue fixed.
close due to no response for long time
I have Autoit3 installed (Hello world is working) and want to use this package in RIDE (2.0b1) on Python 3.7.9 and RF 3.2.2 The log shows this error when I activate AutoItLibrary: Initializing test library 'AutoItLibrary' with no arguments failed: com_error: (-2147221164, 'Klasse is niet geregistreerd', None, None)
Klasse is niet geregistreerd = Class not registered.
What is wrong?