Page 1 of 1

Escape character in file paths

Published: February 14, 2019 - 1:27 AM
by psanchez
Wapt Enterprise 1.6.2.7 in a Win 7 VM on a Windows 2008/R2
PyScripter 3.4.2.7 in a Win 7 VM on a Windows 10

Hello,

I am starting to develop installation packages from exe and I have a problem with file paths.
Here are some examples using Pronote 2018 (thanks to stephane2b and olaplanche):


`run(r'Install_PRNclient_FR_2018.0.2.5_win64.exe -s -f1%s\setup2018.iss' % basedir)`
or `
run(r'Install_PRNclient_FR_2018.0.2.5_win64.exe -s -f1C:\waptdev\lmr-pronote-wapt\setup2018.iss')`
or `
install_exe_if_needed("Install_PRNclient_FR_2018.0.2.5_win64.exe",silentflags= ' -s -f1%s\setup2018.iss' % basedir)`
or
`flagpronote = '-s -f1%s\setup2018.iss' % basedir`
install_exe_if_needed("Install_PRNclient_FR_2018.0.2.5_win64.exe",silentflags=flagpronote)
etc., etc., ...

all these examples result in the following error when executed in PyScripter:

FATAL ERROR: CalledProcessErrorOutput: Command 'Install_PRNclient_FR_2018.0.2.5_win64.exe -s -f1C:\\waptdev\\lmr-pronote-wapt\\setup2018.iss' returned non-zero exit status -2147213312.

I don't understand; the syntax matches what's found in the documentation, in the Pronote thread, in the source code of various packages downloaded from the Tranquil IT repository, etc.

Help!

Thanks

Re: Escape character in file paths

Published: February 14, 2019 - 12:21
by sfonteneau
You must not reference files located in waptdev (you must specify the relative path).

If there is a backslash in the string you are writing, then you must add an 'r' at the beginning of the string.

http://sametmax.com/comment-marchent-le ... en-python/

Re: Escape character in file paths

Published: February 15, 2019 - 03:38
by psanchez
In examples 1, 3, and 4, I use `basedir` with a relative path.
In example 2, I "cracked" and hardcoded the path to the PyScripter development environment to note any potential difference during testing.
I tried all the given examples with and without the `r` at the beginning, but nothing works.

`run('Install_PRNclient_FR_2018.0.2.5_win64.exe -s -f1%s\setup2018.iss' % basedir)`
and `run(r'Install_PRNclient_FR_2018.0.2.5_win64.exe -s -f1%s\setup2018.iss' % basedir)`

both generate the error `-f1C:\\waptdev\\lmr-pronote-wapt\\setup2018.iss'` during the installation test in the PyScripter environment.

Thank you.