[Tutor] Commandline and backslash problem

alan.gauld@bt.com alan.gauld@bt.com
Sun, 28 Oct 2001 21:32:56 -0000


> def go_render():
> ........textfile = inputfile.get() # inputfile is a tkintet 
> ........textfile = string.replace(textfile, '\\', '\\\\')
> ........editor = editorpath.get()# editorpath is a tkinter 
> ........editor = string.replace(editor, '\\', '\\\\')
> ........os.system(r"%s %s" % (editor, textfile))
> ........
> ############## end code snippet
> Nothing happens when I press the button. Writing out the full 
> ........os.system("c:\notepad" "mytext.txt")
> works, 

Suggests you aren't getting the right values. Have 
you tried putting print statements in and looking at 
the output in the console? Just print the values 
immediately after the get() and again before calling 
system()

That will definitively determine whether you are getting 
values out of the widget and whether the replace works.

Failing that can you show us the bit of Tkinter code where 
you build the entry widgets and the button that calls 
the handler above.

Alan g