# an example - choose your own naming
# on Windows
myScriptPath = "c:\\someDirectory\\myLibrary"
# on Mac/Linux
myScriptPath = "/someDirectory/myLibrary"
# all systems
if not myScriptPath in sys.path: sys.path.append(myScriptPath)
# supposing there is a myLib.sikuli
import myLib
# supposing myLib.sikuli contains a function "def myFunction():"
myLib.myFunction() # makes the call
# instead of: import module
如果你的代码里没有定义def方法,那么该模块只加载一次,第二次将不在加载。如果你想重新加载,请使用Jython的reload方法。
import module
reload(module)
# instead of: from module import *
import module
reload(module)
from module import *
把你的代码库自动加到项目环境内:
# works on all platforms
import os
# get the directory containing your running .sikuli
myPath = os.path.dirname(getBundlePath())
if not myPath in sys.path: sys.path.append(myPath)
# now you can import every .sikuli in the same directory
import myLib
New in version X1.0-rc3.
Since scripts in same directory are found automatically:
# nothing else needed
# now you can import every .sikuli in the same directory
import myLib
在你的python项目内加载Jar文件
Loading a jar-file containing Java/Python modules
New in version X1.0-rc2.
load(jar-file)
Loads a jar-file and puts the absolute path to it into sys.path, so the Java or Python code in that jar-file can be imported afterwards.
Parameters:
-
jar-file – either a filename.jar without any path or the absolute path to filename.jar
|
Returns:
True if the file was found, otherwise False
|
Note: if no path is specified, Sikuli first looks into the bundle (the Sikuli folder of the running script) and then into the extensions folder. (more information: Sikuli Extensions)
分享到:
相关推荐
GUI自动化测试的好工具,python语法,代码中可插入界面截图,鼠标会自动寻找并点击等等
网上MMAnalyzer资源太少了,大多数初学者都会少导入JAR包,因为网上的贴的代码只有jeasy.analysis.MMAnalyzer,而没有依赖包lucene-core-2.4.1.jar!
mysql-connector-java-5.1.37-bin.jar是用于java开发中连接数据库包
Spring源代码构建时缺少的一些工具类
axiom-api-1.2.7.jar为的是更好的发扬优良的精要的代码!
commons-lang-2.4.rar代码及jar文件
activemq-all-5.2.0.JAR包,欢迎下载。编写java中间件的时候会用到。这是activemq实现的jms中间件。希望能帮助到你。
-下载后解压zip包,将commons-fileupload-1.1.1.jar,和commons-io-1.2.jar(这里我们用的是更新的版本,但是用法是一样的)复制到tomcat的webapps\你的webapp\WEB-INF\lib\下,如果目录不存在请自建目录。 新建一个...
Junit4所需的 hamcrest-core-1.3.jar和junit-4.12.jar,各编辑器内应该是自带的,如果没有的话可下载这个资源,可以通过项目中导入jar包的方式使用,便于代码开发和方法测试
java实现上传下载的demo,包括jsp和servlet代码。适合初学者,看完之后你会发现java实现上传下载其实很简单。同时我提供了需要用到的两个架包(commons-fileupload-1.2.1.jar;commons-io-1.3.2.jar),把两个架包放...
android-support-v4.jar 对应的源代码包 android-support-source-v4.jar 直接引入就可以查看源代码了
MyBatis-Plus代码生成器
下载Gradle之后通过“gradle cleanIdea eclipse”命令将spring源码转换成可导入eclipse的工程·导入足够的spring工程之后,会发现spring-core下缺少spring-cglib-repack-3.2.0.jar和spring-objenesis-repack-2.2.jar...
common-logging是apache提供的一个通用的日志接口。用户可以自由选择第三方的...使用它的好处就是,代码依赖是common-logging而非log4j, 避免了和具体的日志方案直接耦合,在有必要时,可以更改日志实现的第三方库。
android-support-v4.jar默认不能为它指定源代码,查看或调试时很不方便,我重新打了下包,把源代码打了进去,可以直接查看和调试。
Android 使用android-support-v4.jar类库实现QQ向左滑动删除功能,源代码包中附有android-support-v4.jar类库,其它android应用需要此类库时,也可下载本源码。 制作方法详见源代码文件,操作方法和QQ侧滑删除一样...
commons-collections-3.2.1.jar我们在S2SH框架使用局部刷新Ajax的时候,经常需要返回json数据,有时候,发现明明代码没有问题,就是不显示数据,仔细查看控制台,才发现是jar没有导入完整
fastdfs-client-java-1.27.jar,手动用源代码打包。org.csource.fastdfs-client-java
commons-logging-1.1.1.rar代码及jar文件