Search code examples
pythontclwincvs

WinCVS - Python - TCL


I have got a list of files in txt files and I need to check them out in edit mode, and make some changes(there are word documents), and check them back in via WinCVS.

I know I can write tcl scripts or macro, or python scripts in wincvs shell but I have some problems with them.

I have installed TCL 8.5 and selected tcl DLL in Admin>Preferences, tcl is now available, but whenever I type and execute a tcl script, it says

can not find channel named "stdout"

Do you have any idea regarding this error?

Also, I cannot see admin macros, it says Shell is not available. I have installed the latest version of python and select related dll in preferences.

Could anyone give me a hint for checking a list of files via wincvs?

many thanks in advance,

regards


Solution

  • The problem is that Tcl's trying to build the standard file descriptors into available-by-default channels (i.e., stdin, stdout and stderr) but this goes wrong when they're not opened by default. That's the case on Windows when running disconnected (which is what happens inside GUI applications on that platform). When you're running with a full Tcl shell such as wish, this is worked around, but you're embedded so that's not going to work; the code to fix things isn't run because it's part of the shell startup and not the library initialization (after all, replacing a process-global resource like file descriptors is a little unfriendly for any library to do without the app or user asking it to!)

    The simplest workaround is to not write to stdout – note that it's the default destination of the puts command, so you have to be careful – and to take care not to write to stderr either, as that's probably under the same restrictions (which means that you've got to be careful how you trap errors, especially while testing your script).