I tried to run Nim on UNC path (ex: \\sampleserver\path\to\nimfile\sample.nim ), but failed to compile.
Please let me know if you know how to solve this problem.
nim c -r "\\sampleserver\path\to\nimfile\sample.nim"
oserr.nim(94) raiseOSError
Error: unhandled exception:
Additional info: "\\\\sampleserver" [OSError]
#The problem is that it fails to compile, so please don't go too deep into the contents of this source code.
import os
var fp: File
let openOk = fp.open(r"\\sampleserver\path\to\csv\sample.csv", fmRead)
if openOk:
echo fp.readAll()
else:
raise newException(ValueError, "error.")
Please correct any typos on your own brain.
This is not a compile error, this is a runtime error from the operating system when you try to open that path.
the -r means run after it compiles. If you leave that off it will just compile it.
Thank you very much for trying it. If it can run in your environment and not in mine, then there may be something wrong with my environment.
But, It seems that the problem is not with the runtime, but with the compile time. If you have time, I'd like you to stay on.
The location of the Nim file is the same as before (\\sampleserver\path\to\nimfile\sample.nim), but I changed the file opened in the Nim file (ex: \\anotherserver\path\to\csv\sample.csv). Then, the compile error outputs OS error for path A as follows,
oserr.nim(94) raiseOSError
Error: unhandled exception:
Additional info: "\\\\sampleserver" [OSError]
I think this error is an error for the UNC path of the Nim file. In fact, the Nim file in the local path (ex: C:\) did not cause any compile error or runtime error when the CSV file in the UNC path was opened.
If you have any information on this, please let me know.
Can you try running
nim c "\\\\sampleserver\\path\\to\\nimfile\\sample.nim"
?