← Back to team overview

sikuli-driver team mailing list archive

[Question #258525]: getBundlePath() in Windows returns different slash as os.sep

 

New question #258525 on Sikuli:
https://answers.launchpad.net/sikuli/+question/258525

My environment: Windows 7 + Eclipse Luna + PyDev + jython 2.7b + Sikuli 1.1.0

I was trying to use getBundlePath() with os.path.join() to create the full path to my images but I get a mix of slash and backslash. This is my Eclipse environment:

- d:\development\workspace
      - AutomationFramework
            - source (this is an Eclipse folder that doesn't count in path)
            - images
                   - login

script_location = os.path.dirname(getBundlePath()) # returns 'D:/development/workspace/AutomationFramework'

os.path.join(script_location, 'images", "login") # returns 'D:/development/workspace/AutomationFramework\images\login'

I wonder if getBundlePath() should return the slash used by os.path.sep which is '\' in my Windows environment.

My work around:

script_location = os.path.dirname(getBundlePath())
path_list = script_location.split("/")
path_list.append("images")
path_list.append("login")
image_path = os.path.join(path_list[0], os.sep, *path_list[1:])
addImagePath(image_path)

Is there a better way to do this?

Thanks

Rodolfo




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