[Sikuli-driver] [Question #254991]: ConfigParser Error in Sikuli
New question #254991 on Sikuli: https://answers.launchpad.net/sikuli/+question/254991 Hi , I'm using the ConfigParser module in my sikuli script to fetch data from a testdata.txt file. Here's my code : from sikuli.Sikuli import * import ConfigParser #import os #path = os.environ['Sikuli_Scripts'] class test(): def __init__(self): data = ConfigParser.ConfigParser() #data.read(path+'\\testdata\testdata.txt') data.read('C:\\Automation\\testdata\testdata.txt') self.configurationPackageName = data.get(section,configurationPckageName) self.sourceFolder = data.get(section,sourceFolder) def testMethod(self): for i in self.sourceFolder: print i obj = test() obj.testMethod() :::the content of testdata.txt is below :: [section] configurationPackageName = Test Package sourceFolder = \\192.168.15.23\sms_pri\Client The same code snippet works well on eclipse IDE ..but i encounter [error] ConfigParser.NoSectionError ( No section: 'section' ) when executed via Sikuli IDE I'm using Sikuli 1.0.1 I'm still unable to resolve this issue ..any help/suggestion would be appreciated Thanks -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #254991]: ConfigParser Error in Sikuli
Question #254991 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/254991 Status: Open = Answered RaiMan proposed the following answer: I just checked and found, that you get this error, if the given file cannot be accessed (does not exist e.g.). If the file exists, it works as expected. this might be the problem (a \ escape missing): data.read('C:\\Automation\\testdata\testdata.txt') either use data.read(r'C:\Automation\testdata\testdata.txt') or data.read('C:\\Automation\\testdata\\testdata.txt') -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #254991]: ConfigParser Error in Sikuli
Question #254991 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/254991 bgbig posted a new comment: Thanks for the quick reply RaiMan. Reading data through testdata.txt file works fine with the statement data.read(r'C:\Automation\testdata\testdata.txt') Is there any way I can use a path variable like mentioned above. import os path = os.environ['Sikuli_Scripts'] something like ... data.read(path+r'testdata\\testdata.txt') Is it even viable to use ? -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #254991]: ConfigParser Error in Sikuli
Question #254991 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/254991 RaiMan proposed the following answer: of course you can: the base functions are available in Python module os.path (see Python docs): import os path = os.environ['Sikuli_Scripts'] data.read(os.path.join(path, test data, test data.txt) … no fiddling around with \ -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #254991]: ConfigParser Error in Sikuli
Question #254991 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/254991 Status: Answered = Solved bgbig confirmed that the question is solved: Thanks RaiMan, that solved my question. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp