appium library is unresolved in robocorp extension VS code - python

enter image description here
no matter what i do the ide does not recognize the appium lib
Unresolved library: Appium.
Error generating libspec:
Importing library 'Appium' failed: ModuleNotFoundError: No module named 'Appium'
Consider adding the needed paths to the "robot.pythonpath" setting
and calling the "Robot Framework: Clear caches and restart" action.robotframework

Related

Error when using winshell module: No module named 'win32'

import winshell
r = list(winshell.recycle_bin())
for index, value in enumerate(r):
print(index, value.original_filename())
This is the simple script I wrote, but when I try running it (or antyhing else that uses winshell) I get this error:
ModuleNotFoundError: No module named 'win32'
And when I try running pip install win32 I get another error:
ERROR: Could not find a version that satisfies the requirement win32 (from versions: none)
ERROR: No matching distribution found for win32
So now I'm even more confused. Why does winshell need a different module? That module doesn't even exist. Is it fine if I use some different module than the non-existent win32? If so which one? What am I supposed to do now?
First, you have to execute the script inside the Scripts directory, the pywin32_postinstall.py. Let’s say your Python directory is C:\python3, just follow the code below.
cd C:\python3
python Scripts/pywin32_postinstall.py -install
After that, the installation will drop the DLL files under the C:\Windows\System32. You need to move those two files ( pythoncom310.dll and pywintypes310.dll) to C:\python3\Lib\site-packages\win32 directory.
After that, you need to edit the python310._pth that you can find inside the Python installation folder. Then make the following changes:
Lib/site-packages
Lib/site-packages/win32
Lib/site-packages/win32/lib
Lib/site-packages/pythonwin
python310.zip
#Uncomment to run site.main() automatically
#import site
Save and try running your code again.
Troubleshoot
If you still get an error saying “ImportError: DLL load failed while importing win32api: The specified module could not be found.”, make sure you have copied the two dll files to Lib\site-packages\win32 directory.
PythonWin32Api

Calling C++ from python

I'm trying to call C++ from Python.
import ctypes
clibrary = ctypes.WinDLL("C:/Users/Desktop/SOURCE/build/libmy_library.dll")
my_library.hello_world()
I am most certainly sure that my_library.dll path is exactly correct. But I still get this error:
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\Desktop\SOURCE\build\libmy_library.dll' (or one of its dependencies). Try using the full path with constructor syntax.
What is wrong here?
Note: If it matters my cmake is "Unix Makefiles". And I don't use visual studio, I use VS code.
Edit: Dependency Walker
Error: At least one required implicit or forwarded dependency was not found. Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. Error: Modules with different CPU types were found. Error: A circular dependency was detected. Warning: At least one delay-load dependency module was not found. Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
EDIT
This really fixed it:
dll_name = "C:/Users/Desktop/SOURCE/build/libmy_library.dll"
dll_handle = win32api.LoadLibraryEx(dll_name, 0, win32con.LOAD_WITH_ALTERED_SEARCH_PATH)
my_lib = ctypes.WinDLL(dll_name, handle=dll_handle)

Importing library 'SeleniumLibrary' failed: ModuleNotFoundError: No module named 'SeleniumLibrary' In VS Code

Issue is recurring in VS Code
Error in file 'd:File Location' on line 2: Importing library 'SeleniumLibrary' failed: ModuleNotFoundError: No module named 'SeleniumLibrary'
Traceback (most recent call last):
None
PYTHONPATH:
c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_debug_adapter
D:\Vector.ai\qa-automation-ui
c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src
c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_ls\vendored
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\python38.zip
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\DLLs
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\lib
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\lib\site-packages
[ ERROR ] Error in file 'd:\Vector.ai\qa-automation-ui\KeyWords.robot' on line 2: Importing library 'SeleniumLibrary' failed: ModuleNotFoundError: No module named 'SeleniumLibrary'
Traceback (most recent call last):
None
PYTHONPATH:
c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_debug_adapter
D:\Vector.ai\qa-automation-ui
c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src
c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_ls\vendored
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\python38.zip
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\DLLs
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\lib
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\lib\site-packages
First should be run this command in the command prompt to install the seleniumlibrary in the system:
pip install robotframework-seleniumlibrary
Then, you need to configure your Robocorp Code and Robot Framework Language Server extensions Python path in your Visual Studio Code then restart the Visual Studio Code and then execute your program.
Please refer to the official documentation: https://pypi.org/project/robotframework-seleniumlibrary
I faced same issue in vscode with robocorp extensions.
This fixed the issue for me:
In vscode command palette (ctrl+shift+p), search for "Robocorp: Create Robot" and created a "standard Robot Framework Template".
Now try running tests with Robocorp extension.
You can see in the error message, that robocorp extension is using its own python instance and so it is using packages from
C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\lib\site-packages where seleniumlibrary is not installed.
You need to configure your Robocorp Code and Robot Framework Language Server extensions python path. When you do that, your extensions will be able to see packages (including selenium library) you installed to your python instance. You can configure your extensions in VS Code settings.

python Windows "ImportError: DLL load failed: The specified module could not be found." When loading compiled extension

I compiled a module for python using MinGW64 and it won't load.
I tried checking the file types of the files (with the mingw file command) and they are both 64 bit, so that's not the problem.
The trick was to add the MinGW64 lib path to the PATH.
> set PATH=%PATH%;%MINGW64_ROOT%\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\bin
(Also, to get this to build, I had to define the macro: MS_WIN64).

Errors building Boost.Python tutorial example on Windows

I'm trying to set up Boost.Python 1.54.0 on Windows 7, python 2.7.3. I installed boost_1_54_0 and built it with Visual Studio 2010. I can build and run the quickstart and tutorial examples in the distribution (I had to add some MSVC lib dirs as library-path requirements in Jamroot, but that's OK). But when I copy the tutorial example to a different dir, not inside the boost dist dir, to make it more like a real project, bjam gives build errors. I changed the use-project boost location in Jamroot to /local/boost_1_54_0/ which is where boost wanted to install itself, and added a simple one-line boost-build.jam (based on something I found online):
boost-build C:/local/boost_1_54_0/tools/build/v2 ;
but ultimately bjam gives me this error:
% bjam
notice: no Python configured in user-config.jam
notice: will use default configuration
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:262: in find-jamfile from module project
error: Unable to load Jamfile.
error: Could not find a Jamfile in directory '/local/boost_1_54_0'.
error: Attempted to find it with pattern '[Bb]uild.jam [Jj]amfile.v2 [Jj]amfile [Jj]amfile.jam'.
error: Please consult the documentation at 'http://www.boost.org'.
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:280: in load-jamfile from module project
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:64: in load from module project
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:89: in load-used-projects from module project
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:75: in load from module project
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:145: in project.find from module project
C:/local/boost_1_54_0/tools/build/v2\build-system.jam:535: in load from module build-system
C:\local\boost_1_54_0\tools\build\v2/kernel\modules.jam:289: in import from module modules
C:\local\boost_1_54_0\tools\build\v2/kernel/bootstrap.jam:139: in boost-build from module
C:\tmp\tutorial\boost-build.jam:1: in module scope from module
What else do I need to add, or what am I doing wrong?
I ended up giving up on bjam for this, and just used SCons. A simple SConstruct was enough:
# SConstruct for building boost python tutorial example
import os
boost_python_lib = 'boost_python-vc100-gd-1_54'
boost_top = 'c:/boost'
python_top = 'c:/python27'
env=Environment(TARGET_ARCH='x86',
CCFLAGS=['/MDd', '/DEBUG', '/EHsc'],
CPPPATH=[os.path.join(boost_top,'include/boost-1_54'),
os.path.join(python_top, 'include')],
LIBPATH=[os.path.join(boost_top, 'lib/i386'),
os.path.join(python_top, 'libs')])
dll=env.SharedLibrary('hello_ext', 'hello.cpp',
LIBS=boost_python_lib)
env.InstallAs('hello_ext.pyd', dll[0])
# Copy the boost python lib into this dir so hello_ext will find it at runtime
env.Install('.', os.path.join(boost_top, 'lib/i386', '%s.dll'%boost_python_lib))
Of course you could make a real SCons Tool out of this, but that was enough to get me going. Hope it's useful to others.

Categories

Resources