Showing results for 
Search instead for 
Do you mean 

stdout error....



I have a weird error.  When I post a part file for the first time since opening it, I get an error about not being able to find channel named "stdout".  If I post the file again, it works.  I am writing an overview using a source file, so basically at the very end of my post, I call a proc (defined in soruce file) that takes a bunch of variables and puts them to a .doc file on my desktop.  When I post for the very first time, I see the .doc file being created on my desktop.  However, it is blank.  Any subseqent time that I post, everything runs file and the .doc is written the way I want it to.  The only thing that bugs me is that I can't save or delete the .doc file unless I close out of NX.  


Does anybody have any experience with this?  Im trying to get the post to run without errors on the first try and be able to edit the .doc file without closing out of NX.


my code goes like this:


set filename "overview.doc"
set fileID [open $filename "w"]

puts .....

puts .....

(call proc that also puts stuff)

puts ....

puts .....


close $fileID


Re: stdout error....

Is the fileID variable passed to the called proc, or is it define as a "global"?


Note if there is an error writing to external files (or the post output file) the file may end up being "locked' and behave strangely (until you exit & restart NX).

I run into this all the time (during post development) with LPT files (although as I'm in NX7.5, that issue is hopefully fixed by NX10)



Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled

Re: stdout error....

I tried adding:


global fileID


to the header of my proc, but that didn't fix it.  Do I need to do anything else?  If its relevant, its choking before it gets to the proc anyway.



Re: stdout error....

And just to clarify, have you seen the stdout error before and you just work around it?  Or were you referring to being unable to edit the file while NX is open?

Re: stdout error....

set filename "C:/Users/Public/Desktop/test.doc"
set fileID [ open $filename w+ ]

puts $fileID "This is a test. \n"
puts $fileID "Did it work?"

close $fileID

This worked for me. Did you add the $fileID after the puts?


Re: stdout error....

[ Edited ]

{puts "something to output"} will try to print out the string to the so called "standard output device" (aka. stdout). In the Unix world, this is the shell window where you would execute the scrip to start the program. This "stdout" device does not exist in the Windows' world by default.


If your intent is to print stuff to a file, you should do {puts $fileChannelID "stuff to output"}.


Although your 2nd run did not produce error, it might not have produced proper result as intended.  You would still need to fix the original error first.


BTW, "fileID" does not need to be "global", as long as it's "present" when "puts $fileID ..." is being called.

Re: stdout error....

RE: global

I was concerned about this line:


"(call proc that also puts stuff)"


If fileID is local variable in the calling proc, then it is not available in the called proc.

It either needs to be defined global in BOTH the "main" and "called" proc,

or else passed as a parameter:


puts $fileID "something"
Whatever_The_Proc_is $fileID
puts $fileID "something else"




and  that proc needs to be defined:


proc Whatever_The_Proc_is  { FILE_ID_PASSED_IN } {

    puts $FILE_ID_PASSED_IN "This is some text"

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled

Learn online

Solution Information