Sikuli App.open(FFpath) using external file wont work need help

Asked by Ninja Mustang

Hi,

my config.txt file, first line has the path to Firefox
c:\\program files (x86)\\mozilla firefox\\firefox.exe

Sikuli IDE
# read configure file
myURL = []
URLlist = open('c:\\config\\config.txt', 'r')
for site in URLlist:
    myURL.append(site)
URLlist.close()

# open Firefox
FFPath = myURL[0]
print FFPath
FFApp = App.open(FFPath)
wait(2)

It will fail open that firefox path

However, if I just make an array as below, it opens fine.
firefoxPath = ['c:\\program files (x86)\\mozilla firefox\\firefox.exe']
FFPath = firefoxPath[0]

Can someone let me know how can I make it work from a config.txt file? Thx!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Ninja Mustang (ninjamustang) said :
#1

oh yeah, the config file just has single back-slash, no need 2.
c:\program files (x86)\mozilla firefox\firefox.exe

Revision history for this message
Best RaiMan (raimund-hocke) said :
#2

you must strip the linefeed:

FFPath = myURL[0].strip()

Revision history for this message
Ninja Mustang (ninjamustang) said :
#3

Thanks RaiMan, that solved my question.