Thanks to the discussion at Unable to load file on network from Linux I can now open CSV files on our Windows server as Calc documents, even from Linux. The key was using the ConvertToURL function, which changes the initial “file://” of a file path to “smb://”, so that Linux knows to use Samba to access the file.
But now I’m trying to do some simple file access to just append a few lines of text to a log file on the Windows server, and I am again having problems. You can see from that other page that I gave a basic example of reading from a text file. That still seems to work fine, whether you use “file://” or “smb://” at the beginning of the path. But if I try to open the file for Output or Append, I always get an error 57 Device I/O error on the open command. But that doesn’t happen if I am writing to a local file on the computer, just over the network. And it doesn’t happen if I open the file for Input to read from a file on the server.
Just to make it clear, here’s what works:
fileURL = "smb://abc.def.org/server/Data/Finance/Reconcile.log"
Open fileURL For Input As #1
Line Input #1, sStr
This works if I put “file://” at the start as well, but I imagine smb is probably better, since it is required for the loadComponent call. This also works:
fileURL = "file:///home/user/Bureau/Reconcile.log"
Open fileURL For Append As #1
Print #1, "This is a test"
which is on the local machine, for Output or Append. But this fails with an error 57 on the Open call:
fileURL = "smb://abc.def.org/server/Data/Finance/Reconcile.log"
Open fileURL For Append As #1
Print #1, "This is a test"
So the problem is just writing to the text file on the server. But I use the storeAsURL method to save .ods files to the server from Linux quite a lot, so there isn’t a networking or permissions problem. In fact when I run that Open/Append command with a fileURL of a file that does not exist, it actually creates the file on the server before giving the error.
Any suggestions?
(Linux Mint 16 French, LO Calc 4.1.2.3 French)