Reputation: 1
When I try to import python Library in RIDE (robot framework IDE), it fails because the library imports java.lang.
The RIDE Log shows the following error:
Importing test library '../libraries/ExampleLibrary.py' failed: ImportError: No module named java.lang
Here is the sample test case to multiply written for robot frame work
*** Settings ***
Library ../libraries/ExampleLibrary.py
Library ../libraries/NorthboundLibrary.py
*** Test Cases ***
Hello World
Log Hello, World!
Multiply Test
Multiply Me 8 8
Method defined in the ExampleLibrary.py
../libraries/ExampleLibrary.py
import os
import sys
from java.lang import Math
from com.cisco.csdn.tifmgr import TIFConfig
def multiply_me(first, second):
print '*DEBUG* Got arguments %s and %s' % (first, second)
return float(first) * float(second)
RIDE failed to load the ExampleLibrary.py
Upvotes: 0
Views: 1951
Reputation: 2384
RIDE executes in CPython, not inside a JVM, and therefore has no way understand Java or Jython code. Your example code is Jython and will not work in CPython. If you want the help and auto-completion that RIDE provides, you should create spec files for your libraries using libdoc and make sure RIDE can find them.
Upvotes: 1
Reputation: 888
Why are you importing
from java.lang import Math
from com.cisco.csdn.tifmgr import TIFConfig
?
In the code you showed you are not using them.
Also why are you importing a Java class in Python ?
Just remove these two lines and you'd be fine.
Upvotes: 1