[Tutor] Commandline and backslash problem
Sun, 28 Oct 2001 21:52:35 +0100
Quite right Roeland! I noticed this also 30mins ago, my application works =
"halfway" now. The wierdest, saddest thing is that switches don=B4t work wit=
....prog =3D "C:\\blah.exe"
....switch =3D "-q"
....file =3D "aha.txt"
os.system("%s %s %s" %(prog, switch, file))
#### end example
the commandline application mentions "error, file not found-> -q" , appare=
ntly it thinks that the switch is a file, this is then skipped and it exec=
utes but without the switch.
Are switches built this way passed separately to the commandline=3F I took a=
look at execl and spawnv, they did=B4nt work in my function, they just did =
not execute the commandline application :-(=20
Roeland Rengelink <firstname.lastname@example.org> schrieb am 28.10.01:
Are you sure this is a backslash problem
I made this little testprogram, and as far as I can tell Entry.get() is
smart about escaping the backslashes.
from Tkinter import *
t =3D e.get()
print t, repr(t)
e =3D Entry()
b =3D Button(text=3D'do', command=3Dev)
Some example output
> I have the "backslash" problem with an application I=B4m developing. I kno=
w about escaping forward slashes or using raw strings, but things are not =
working as I expect. A code snippet:
> #################code -start
What do you get if you replace go=5Frender with:
textfile =3D inputfile.get()
editor =3D editorpath.get()
os.system("%s %s" % (editor, textfile))
As far as I can tell there's no need to do the string replacement
Hope this helps,
"Half of what I say is nonsense. Unfortunately I don't know which half"
Lotto online tippen! Egal zu welcher Zeit, egal von welchem Ort.
Mit dem WEB.DE Lottoservice. http://tippen2.web.de/=3Fx=3D13