Close

SMB on the Pi

A project log for MiFrame - Yet Another (Raspberry) Pi Smart Frame

MiFrame is a Python Smart Photo Frame application. Supports sharing database across multiple frames, marking favorites, thumbs up etc

tklenketklenke 03/02/2017 at 04:560 Comments

I'm writing this a couple of weeks after the fact. Really, what I wanted to do was to just mount my Windows Share on the Pi as just another directory. With my Ubuntu instance it was done after about 5 minutes of Googling. "Mount windows share on ubuntu"

But when I went to do it on the PIXEL instance...not so much. Yes, it seems trivial, mount -t cifs yada yada. It didn't work for me. Maybe something with my Windows setup, maybe something with the PIXEL i386 kernel (that's what I concluded, but when the googling got to "modprobe" I knew that I was in over my head/interest)

Anyway, the hack I fell back on was to use the smbconnection module in python. Even that was a bit of screwing around, but I got it all working.

One of the things you might notice in the code is that I read the file from the Windows Share into an IO stream. The example for SMBConnection actually writes to a file. I did not want to write to a file...I'm thinking that if every time we look at a new image we'd have to write that image from the share to the Pi's disk would be bad for the long term heath of the Raspberry Pi's sd card. I used an IO stream and read the image file from the Share into memory then loaded the image into TKinter's ImageTk module from that memory.

Discussions