| 2015 | 2014 | 2013 | 2012 | | 2010 | | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

# Re: [QF-Test] Replace a backslash by two backslashes

• Subject: Re: [QF-Test] Replace a backslash by two backslashes
• From: René Hegeman <Rene.Hegeman@?.nl>
• Date: Thu, 16 Aug 2007 10:12:47 +0200

```Thanks Greg,

The i_path is now correctly converted into \\\\server\\folder\\file.txt
Unfortunately, when running the next script lines, it resulted in another error message:

Script lines:
o_file_size = os.path.getsize("\$(i_path)")
rc.setGlobal("o_file_size", o_file_size)

Error message:
No such file or directory:  \server\folder\file.txt

Do you have another idea?

Best regards,
René

-----Oorspronkelijk bericht-----
Van: Gregor Schmid [mailto:Gregor.Schmid@?.de]
Verzonden: woensdag 15 augustus 2007 18:49
Aan: qftest-list@?.de
CC: René Hegeman
Onderwerp: Re: [QF-Test] Replace a backslash by two backslashes

Hi René,

that's trivial: You need to escape the backslash for Jython as well, so use

name = name.replace('\\','\\\\')

Best regards,
Greg

René Hegeman <Rene.Hegeman@?.nl> writes:

>    Hi all,
>
>
>
>    I am trying to replace a backslash by two backslashes with this script:
>
>
>
>    name = rc.lookup("i_path")
>    name = name.replace('\','\\')
>    rc.setLocal("i_path", name)
>
>
>
>    i_path can be [1]\\server\folder\file.txt and need to be transferred
>    into \\\\server\\folder\\file.txt
>
>
>
>    However, this scripts gives an error message:
>
>    SyntaxError: Lexical error at line 4, column 27. Encountered: "\\"
>    (92), after : "\\"
>
>
>
>    Does anyone knows how to replace the backslash by two backslashes?
>
>
>
>    Greetings,
>
>
>
>    René Hegeman
>
>    Planon
>
> Verweise
>
>    1. file://\\server\folder\file.txt/
> _______________________________________________
> qftest-list mailing list
> qftest-list@?.de
> http://www.qfs.de/mailman/listinfo/qftest-list

--
Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH                     http://www.qfs.de
Tulpenstr. 41                                Tel: +49 8171 919870
DE-82538 Geretsried                          Fax: +49 8171 919876
GF: Gregor Schmid, Karlheinz Kellerer          HRB München 140833

```