← Back to team overview

sikuli-driver team mailing list archive

[Bug 1810580] [NEW] Backslash on the end of string does not work

 

Public bug reported:

Hi!
I would like to define a STRING with a path, using a backslash at the last character. Obviously that's not so simple. look at the  script:

IMGFILE=r'C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\' # does not work
Pathlog = r'Path used..'
print IMGFILE

IMGFILE='C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\' # does not work
Pathlog = r'Path used..'
print IMGFILE
        
IMGFILE="C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\" # does not work
Pathlog = r'Path used..'
print IMGFILE
        
IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\" # does not work
Pathlog = r'Path used..'
print IMGFILE

IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log"   # does work, but not what I need
Pathlog = r'Path used..'
print IMGFILE

IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\ "  # I dont need the space in the end
Pathlog = r'Path used..'
print IMGFILE
        
IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log" +r"\ ".strip()  # finally something I can use
Pathlog = r'Path used..'
print IMGFILE

exit()

Output:
Path used..
Path used..
Path used..
Path used..
C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log
C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\ 
C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\
C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\
[info] Exit code: 0

AND:

IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log" +r"\"  # lets close with an error
Pathlog = r'Path used..'
print IMGFILE

[error] script [ test ] stopped with error in line 29 at column 8
[error] SyntaxError ( "can't assign to operator", )

I am using Sikulix IDE 1.1.4 SNAPSHOT on Windows10

Thanks

** Affects: sikuli
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1810580

Title:
  Backslash on the end of string does not work

Status in Sikuli:
  New

Bug description:
  Hi!
  I would like to define a STRING with a path, using a backslash at the last character. Obviously that's not so simple. look at the  script:

  IMGFILE=r'C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\' # does not work
  Pathlog = r'Path used..'
  print IMGFILE

  IMGFILE='C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\' # does not work
  Pathlog = r'Path used..'
  print IMGFILE
          
  IMGFILE="C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\" # does not work
  Pathlog = r'Path used..'
  print IMGFILE
          
  IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\" # does not work
  Pathlog = r'Path used..'
  print IMGFILE

  IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log"   # does work, but not what I need
  Pathlog = r'Path used..'
  print IMGFILE

  IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\ "  # I dont need the space in the end
  Pathlog = r'Path used..'
  print IMGFILE
          
  IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log" +r"\ ".strip()  # finally something I can use
  Pathlog = r'Path used..'
  print IMGFILE

  exit()

  Output:
  Path used..
  Path used..
  Path used..
  Path used..
  C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log
  C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\ 
  C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\
  C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log\
  [info] Exit code: 0

  AND:

  IMGFILE=r"C:\Users\boi\Google Drive\Screenshots\SymbolsWD\log" +r"\"  # lets close with an error
  Pathlog = r'Path used..'
  print IMGFILE

  [error] script [ test ] stopped with error in line 29 at column 8
  [error] SyntaxError ( "can't assign to operator", )

  I am using Sikulix IDE 1.1.4 SNAPSHOT on Windows10

  Thanks

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1810580/+subscriptions


Follow ups