I have an issue with folderitem failure with a NilObjectException on code Ive compiled for the Raspberry Pi. The same code runs on a Mac without problems. It could be some detail Ive overlooked in the Linux setup code, but I cant figure it out. It may be a XOJO ARM compiler issue, so Im posting it here because, frankly, Ive tried everything I can think of to get it to work.
A network drive, root, is used for file sharing at our company.
The user pi exists in the domain on the Windows 2008 R2 server that root is attached to.
I mount the root drive from the pi using:
sudo mount -t cifs //[IP address]/root/Company/MessageBoard /mnt/myroot -o username=[my pi user],dom=[our domain],uid=[valid user id],gid=[group id (tried several)]
I manually enter the password when prompted by the mount command.
I can navigate to the newly mounted myroot and to the root/Company/MessageBoard subfolder that I need access to:
I have Read/Write/Execute permissions in the MessageBoard folder.
I have tested the pi permissions in the folder using vi to create a new file from the RasPi. I can create it, save it, and open/read it just fine:
So far, so good.
However, as soon as I try to create a folderitem object with that path, I get a NilObjectExecption. The code is as follows:
// // Returns a folderitem pointing to the Message Board folder (where DB and files reside) // Returns Nil if root drive not found // Dim i, numVolumes as Integer dim myFolderItem as FolderItem numVolumes = VolumeCount-1 For i=0 to numVolumes // Windows #if TargetWin32 // Win volumes will be C:, D:, Z:,etc. The mount I need could be any drive letter, // so look for the Company\\MessageBoard folder within it try myFolderItem = Volume(i).Child("Company").Child("MessageBoard") catch err as NilObjectException msgbox "Error: NilObjectException. Is the drive mounted?" quit end try #endif // RasPi #if TargetLinux or TargetARM try myFolderItem = Volume(i).Child("mnt").Child("myroot").Child("Company").Child("MessageBoard") catch err as NilObjectException msgbox "Error: NilObjectException. Is the drive mounted?" quit end try #endif // MacOS #if TargetMacOS try myFolderItem = Volume(i).Child("Company").Child("MessageBoard") catch err as NilObjectException msgbox "Error: NilObjectException. Is the drive mounted?" quit end try #Endif // see if this is the correct Volume (does the folderitem exist?) if (myFolderItem <> Nil) AND (myFolderItem.Exists) then return(myFolderItem) // found it, so return folderitem end if Next return(Nil) // can't locate the mounted share drive, so tell calling method we're Nil
The RasPi section works fine if I do:
myFolderItem = Volume(i).Child(“mnt”).Child(“myroot”)
That is, if I stop at what is mounted after the mount command, above. However, it gets the same NilObjectException if I later try:
f = myFolderItem.Child(“Company”).Child(“MessageBoard”)
I’ve also tried the Linux mount command with the entire path to the MessageBoard folder, but that also fails when I try to setup the SQLite database filename:
DB_File = MsgBoardPath.Child(“theDB.rsd”)
In the interest of brevity, I have not included many other attempts to get it to work. It is most likely something I’m doing incorrectly, but I’m out of ideas.
Thanks in advance for your advice/comments/public humiliation/etc.