TCL throws invalid command name when writing csv data to a matrix within a namespace -
TCL throws invalid command name when writing csv data to a matrix within a namespace -
this bizarre issue can't seem figure out. using tcl 8.5 , trying read info csv file matrix using csv::read2matrix
command. however, every time it, says matrix trying write invalid command. snippet of doing:
package require csv bundle require struct::matrix namespace eval ::iostandards { namespace export * } proc iostandards::parse_stds { io_csv } { # create matrix puts "creating matrix..." struct::matrix iostdm # add together columns puts "adding columns matrix..." iostdm add together columns 6 # open file set fid [open $io_csv r] puts $fid # read csv matrix puts "reading info matrix..." csv::read2matrix $fid iostdm {,} close $fid }
when run code in tclsh, error:
invalid command name "iostdm"
as far can tell, code right (when don't set in namespace. tried namespace import ::csv::* ::struct::matrix::*
, didn't anything.
is there missing these packages? nil on wiki.tcl.tk website mentions of sort, , man packages packages don't mention beingness called within namespace.
the problem iostdm defined within iostandards namespace. means, should referenced iostandards::iostdm, , how should pass csv::read2matrix
:
csv::read2matrix $fid iostandards::iostdm {,}
update i noticed hard-coded adding 6 columns matrix before reading. improve way tell csv::read2matrix
expand matrix automatically:
csv::read2matrix $fid iostandards::iostdm , auto
csv tcl
Comments
Post a Comment