Hi,
can somebody help me make this compile?
import encodings
proc parse_table(table_path: string) =
var
current_line: string
encoder = encodings.open("UTF-8")
f = open(table_path)
defer: close(f)
parse_table("testtable.txt")
https://play.nim-lang.org/#ix=2FEA
Thanks
You should declare f with this:
f = system.open(table_path)
Full error message:
Error: ambiguous call; both io.open(filename: string, mode: FileMode, bufSize: int) [declared in /playground/nim/lib/system/io.nim(725, 6)] and encodings.open(destEncoding: string, srcEncoding: string) [declared in /playground/nim/lib/pure/encodings.nim(306, 6)] match for: (string)
Change your line to either f = system.open(table_path) or f = encodings.open(table_path)
Ahhh system, not io.
Thank you 👍