← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #207655]: Need to pass input as file from user

 

Question #207655 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/207655

    Status: Open => Answered

Andrew Munro proposed the following answer:
RaiMan's solution is fairly simple so I'm guessing you don't have much
python experience. I will try walk you through a simpler solution using
pythons configparser:

Create a text file in the same folder that has your script.sikuli in and
call it 'config.ini'

Then type in your config variables, here is an example:

[vmsettings] # This is the 'section'

esxip = xxxx
name  = xxxx


Then in your sikuli script, at the top put:

import ConfigParser

config = ConfigParser.ConfigParser()
config.read("config.ini") # Or put in the absolute path to the config.ini file


Now you can get all your variables from the config file by doing:

#var = config.get(section, variable)

esxip = config.get(vmsettings,esxip)
name = config.get(vmsettings,name)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.