TCL in Python: can't find package
Question: I am trying to run a TCL script from python. There is a very specific TCL
package embedded in some software I am using and I need to tell the python
interpreter (or TKinter ?) where this package is. Here is what I have tried so
far.

    
    
    >>> import Tkinter
    >>> r = Tkinter.Tk()
    >>> r.tk.eval('lappend auto_path C:/Program Files (x86)/Ixia/IxNetwork/7.0-EA/tcl8.4/bin')
    >>> r.tk.eval('lappend auto_path C:\\Program Files (x86)\\Ixia\\IxNetwork\7.0-EA\\tcl8.4\\bin\\')
    '{C:\\Python26\\tcl\\tcl8.5} C:/Python26/tcl C:/lib {C:\\Python26\\tcl\\tk8.5} {C:\\Python26\\tcl\\tk8.5/ttk} C:/Program Files (x86)/Ixia/IxNetwork/7.0-EA/tcl8.4/bin C:Program Files (x86)IxiaIxNetwork\x07.0-EA\\tcl8.4\x08in\\\\'
    

I want to use the following TCL shell which I copied from the windows start
menu:

    
    
    "C:\Program Files (x86)\Ixia\IxOS\6.40-EA\TclScripts\bin\wish84.exe" "C:\Program Files (x86)\Ixia\IxOS\6.40-EA\TclScripts\bin\IxiaWish.tcl"
    

Firstly, can someone tell me why there are two items being referred to in the
start menu shortcut target? Will I be able to access this for my TCL in
python?

As you can see from above, I have tried appending this package to the
auto_path, but there are problems with characters. Does anyone know why the
characters are mixed up?


Answer: I don't understand what you are trying to accomplish. If all you want to do is
to execute the following command:

    
    
    "C:\Program Files (x86)\Ixia\IxOS\6.40-EA\TclScripts\bin\wish84.exe" "C:\Program Files (x86)\Ixia\IxOS\6.40-EA\TclScripts\bin\IxiaWish.tcl"
    

Then why not use `subprocess`? Something along this line:

    
    
    import subprocess
    command = [
        r'C:\Program Files (x86)\Ixia\IxOS\6.40-EA\TclScripts\bin\wish84.exe',
        r'C:\Program Files (x86)\Ixia\IxOS\6.40-EA\TclScripts\bin\IxiaWish.tcl'
    ]
    p = subprocess.Popen(commands, 
            shell=True, 
            stdout=subprocess.PIPE, 
            stderr=subprocess.PIPE)
    stdout, stderr = p.communicate()
    

