This is a bizarre issue that I can't seem to figure out. I am using TCL 8.5 and I am trying read data from a CSV file into matrix using the csv::read2matrix
command. However, every time I do it, it says the matrix I am trying to write to is an invalid command. Snippet of what I am doing:
package require csv
package require struct::matrix
namespace eval ::iostandards {
namespace export *
}
proc iostandards::parse_stds { io_csv } {
# Create matrix
puts "Creating matrix..."
struct::matrix iostdm
# Add columns
puts "Adding columns to matrix..."
iostdm add columns 6
# Open File
set fid [open $io_csv r]
puts $fid
# Read CSV to matrix
puts "Reading data into matrix..."
csv::read2matrix $fid iostdm {,}
close $fid
}
When I run this code in a TCLSH, I get this error:
invalid command name "iostdm"
As far as I can tell, my code is correct (when I don't put it in a namespace. I tried the namespace import ::csv::* ::struct::matrix::*
and it didn't do anything.
Is there something I am missing with these packages? Nothing on the wiki.tcl.tk website mentions anything of the sort, and all man packages for packages don't mention anything about being called within another namespace.