简体   繁体   中英

How to execute python script file (filename.py) using sikuli

I have a python code (name.py) written in separate file and now I want to execute that code using sikuli.

I have tried openApp but its not working could be possible I did some mistake but still looking for working logic.

openApp is for running an application for example: openApp("calc.exe"). Please read about importing python modules . Technically this has nothing to do with Sikuli.

Try this:

run(python name.py)

I use similar approach to run my ruby scripts. My problem with it is that it waits for your script to finish, but it shouldn't realy be a problem in 90% of the cases.

Do you want to run the file as an executable script or use its contents?

As an executable script make sure that the file is a valid script and will execute something when called and then use suprocess.Popen() from another .py file to execute that file.

To use the module's contents make sure the file is on the PYTHONPATH and use import name and everything within name will now be available for use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM