nokia / robotframework-autoitlibrary

Other
38 stars 33 forks source link

Issue downloading library (Windows paths) #17

Closed terrafied closed 4 years ago

terrafied commented 5 years ago

There was an issue addressed in #1, but there is more to this issue. To wit

 Running setup.py install for robotframework-autoitlibrary ... error
    ERROR: Complete output from command 'c:\program files (x86)\microsoft visual studio\shared\python37_64\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\mail\\AppData\\Local\\Temp\\pip-install-6x6avtkn\\robotframework-autoitlibrary\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\mail\AppData\Local\Temp\pip-record-pq_k2_99\install-record.txt' --single-version-externally-managed --compile:
    ERROR: Don't think we need to unregister the old one...
    %SYSTEMROOT%\system32\regsvr32.exe /S c:\program files (x86)\microsoft visual studio\shared\python37_64\Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\mail\AppData\Local\Temp\pip-install-6x6avtkn\robotframework-autoitlibrary\setup.py", line 75, in <module>
        subprocess.check_call(cmd, shell=True)
      File "c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '%SYSTEMROOT%\system32\regsvr32.exe /S c:\program files (x86)\microsoft visual studio\shared\python37_64\Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll' returned non-zero exit status 3.
    ----------------------------------------
ERROR: Command "'c:\program files (x86)\microsoft visual studio\shared\python37_64\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\mail\\AppData\\Local\\Temp\\pip-install-6x6avtkn\\robotframework-autoitlibrary\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\mail\AppData\Local\Temp\pip-record-pq_k2_99\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\mail\AppData\Local\Temp\pip-install-6x6avtkn\robotframework-autoitlibrary\

PS > C:\Windows\system32\regsvr32.exe /S c:\program files (x86)\microsoft visual studio\shared\python37_64\Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll
x86 : The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:55
+ C:\Windows\system32\regsvr32.exe /S c:\program files (x86)\microsoft  ...
+                                                       ~~~
+ CategoryInfo          : ObjectNotFound: (x86:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

PS > C:\Windows\system32\regsvr32.exe /S "c:\program files (x86)\microsoft visual studio\shared\python37_64\Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll"
<-------- NO ERROR
PS >

On Windows, paths with spaces seem to be surrounded by double quotes in the shell (I'm mostly a *nix user, so this seems to be the issue). Updating the script to put double quotes around that command's path works, but it fails (even with Admin privileges) without that. I've run into this on two separate Windows 10 systems (Python 3.7), pyWin32 installed.

terrafied commented 5 years ago

The offending lines in my setup script are this raw string literal on line 73 and this command on line 84. Hacking those to surround the path with double quotes allows a successful install. Unfortunately, it breaks the ability to use r"" in 73. I ran that command manually in Powershell. Just to give you more information.