Re: [Sikuli-driver] [Question #403680]: Using ConfigParser with Sikuli error

2019-08-02 Thread Ju1+i-我 .
Question #403680 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/403680

Ju1+i-我. posted a new comment:
dear ,  it's resolved , change the  encoding to ANSI of the config file

-- 
You received this question notification because your team Sikuli Drivers
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 #403680]: Using ConfigParser with Sikuli error

2019-08-02 Thread Ju1+i-我 .
Question #403680 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/403680

Ju1+i-我. requested more information:
this is the error details : MissingSectionHeaderError: File contains no
section headers. file:
C:\rpaProject\config\monitorSnow\monitorSnowInfomations_sap.conf, line:
1 '\xef\xbb\xbf#\xe7\x94\xa8\xe6\x88\xb7\xe4\xbf\xa1\xe6\x81\xaf\n'

and this is the config file :

[SNOW]
snow_url = "https://vfc.service-now.com/;

-- 
You received this question notification because your team Sikuli Drivers
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 #403680]: Using ConfigParser with Sikuli error

2019-08-02 Thread Ju1+i-我 .
Question #403680 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/403680

Ju1+i-我. requested more information:
this is the error details : MissingSectionHeaderError: File contains no
section headers. file:
C:\rpaProject\config\monitorSnow\monitorSnowInfomations_sap.conf, line:
1 '\xef\xbb\xbf#\xe7\x94\xa8\xe6\x88\xb7\xe4\xbf\xa1\xe6\x81\xaf\n'

and this is the config file :

[SNOW]
snow_url = "https://vfc.service-now.com/;

-- 
You received this question notification because your team Sikuli Drivers
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 #403680]: Using ConfigParser with Sikuli error

2019-08-02 Thread Ju1+i-我 .
Question #403680 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/403680

Ju1+i-我. requested more information:
dear , i'm facing the same issue

import ConfigParser
cp = ConfigParser.SafeConfigParser()

cp.read("C:\\rpaProject\\config\\monitorSnow\\monitorSnowInfomations_sap.conf")

cp.get("SNOW" , "snow_url")


can you pls help me on this ? thanks

-- 
You received this question notification because your team Sikuli Drivers
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 #403680]: Using ConfigParser with Sikuli error

2016-10-31 Thread masuo
Question #403680 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/403680

Status: Open => Answered

masuo proposed the following answer:
Change config.readfp() to config.read().

-- 
You received this question notification because your team Sikuli Drivers
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


[Sikuli-driver] [Question #403680]: Using ConfigParser with Sikuli error

2016-10-31 Thread monica
New question #403680 on Sikuli:
https://answers.launchpad.net/sikuli/+question/403680

sorry for the repeat. I accidently marked the question as solved when it 
wasn't. 

this is the error I am getting

[error] script [ testingSki ] stopped with error in line 4
[error] AttributeError ( 'str' object has no attribute 'readline' )
[error] --- Traceback --- error source first line: module ( function ) 
statement 286: ConfigParser ( readfp ) File 
"C:\Users\ffi1\Downloads\sikuli\sikulix.jar\Lib\ConfigParser.py", line 430, in 
_read
[error] --- Traceback --- end --


this is my code 

import ConfigParser

config = ConfigParser.ConfigParser()
config.readfp('C:\\Users\\ffi1\\Desktop\\con.ini')
username1 = config.get('user1','username')
username2 = config.get('user2','username')


con.ini 

[user1]
username=Guido Van Rossum
ip = 192.168.0.1
machineName=Guido's Machine
system = Ubuntu

[user2]
username = Bob Marley
ip = 192.168.0.1
machineName= Bob's Machine
system = windows 7

this is the line 430 error


def _read(self, fp, fpname):
"""Parse a sectioned setup file.

The sections in setup file contains a title line at the top,
indicated by a name in square brackets (`[]'), plus key/value
options lines, indicated by `name: value' format lines.
Continuations are represented by an embedded newline then
leading whitespace.  Blank lines, lines beginning with a '#',
and just about everything else are ignored.
"""
cursect = None# None, or a dictionary
optname = None
lineno = 0
e = None  # None, or an exception
while True:
line = fp.readline()
if not line:
break
lineno = lineno + 1
# comment or blank line?
if line.strip() == '' or line[0] in '#;':
continue
if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR":
# no leading whitespace
continue
# continuation line?
if line[0].isspace() and cursect is not None and optname:
value = line.strip()
if value:
cursect[optname] = "%s\n%s" % (cursect[optname], value)
# a section header or option header?
else:
# is it a section header?
mo = self.SECTCRE.match(line)
if mo:
sectname = mo.group('header')
if sectname in self._sections:
cursect = self._sections[sectname]
elif sectname == DEFAULTSECT:
cursect = self._defaults
else:
cursect = {'__name__': sectname}
self._sections[sectname] = cursect
# So sections can't start with a continuation line
optname = None
# no section header in the file?
elif cursect is None:
raise MissingSectionHeaderError(fpname, lineno, line)
# an option line?
else:
mo = self.OPTCRE.match(line)
if mo:
optname, vi, optval = mo.group('option', 'vi', 'value')
if vi in ('=', ':') and ';' in optval:
# ';' is a comment delimiter only if it follows
# a spacing character
pos = optval.find(';')
if pos != -1 and optval[pos-1].isspace():
optval = optval[:pos]
optval = optval.strip()
# allow empty values
if optval == '""':
optval = ''
optname = self.optionxform(optname.rstrip())
cursect[optname] = optval
else:
# a non-fatal parsing error occurred.  set up the
# exception but keep going. the exception will be
# raised at the end of the file and will contain a
# list of all bogus lines
if not e:
e = ParsingError(fpname)
e.append(lineno, repr(line))
# if any parsing errors occurred, raise an exception
if e:
raise e

-- 
You received this question notification because your team Sikuli Drivers
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