I am trying to use my RaspberryPi as a photoviewer, using the thousands of photo's from my NAS. I've build python scripts to show a random selection of the photo's. The NAS is not allways up, so my script checks if the NAS can be reached and then copies 100 random photo's to the local disc. On a Windows pc I made the connection to the NAS using smb.SMBConnection, from the anaconda lib. But on the pi I have to use another kind of connecting lib. I looked at SAMBA, but I can't find if I can use the SAMBA lib from Python or how. Also I looked at fstab to mount the path, but during BOOT the NAS is never up, so I'm affraid this would bring errors and if the NAS is turned on later, the pi wouldn't see the connection without reboot.

Does anybody have an idea to achive this?

  • Welcome -- but the Pi is at most tangential to this, and general programming questions, including how to use common python libraries, belong on our larger parent site, Stack Overflow. If by "the SAMBA lib from Python" you mean pypi.org/project/pysmb I don't see why you are assuming you cannot. It usually makes more sense to actually try something in code rather than asking other people if you can, since 1) It's faster, 2) Otherwise the question implies you could not be bothered to try, which does not behove other people bothering to help you... – goldilocks Dec 1 '19 at 18:16
  • And 3) Because then when you run into a difficulty you can present a more focussed and concrete question, including actual code. BTW, if you did mean pysmb, it's explicitly described on that homepage as "an experimental SMB/CIFS library written in Python to support file sharing between Windows and Linux machines" (== Raspberry Pi running Raspbian or other linux distro), so while I am not a python user myself, I think it is safe to say the answer is yes. – goldilocks Dec 1 '19 at 18:17
  • Thanks for your answer. I hoped it was clear that of course I tried all the options I mentioned, but nothing seems to do the trick on the pi, where it works great on other machines. That's why I specifically asked my questions on the Pi-platform. I assume it is an Pi specific problem. The SAMBA lib I referred to is a complete project, and I am wondering if I can use parts of the original modules to work for me. I'll try my question on stackoverflow. – Theo Grivel Dec 2 '19 at 19:29
  • "I hoped it was clear that of course I tried all the options I mentioned" -> Actually it's not clear you'd tried anything at all. You say you have code that works on some other computer, "But on the pi I have to use another kind of connecting lib". You don't say why you believe that, so it appears to be a presumption, meaning, you have not bothered to try because you assume it will not work. If you have tried something and it doesn't work, you show show some code -- a minimal example demonstrating the issue, and explain what it is supposed to do and how it fails (error messages, etc). – goldilocks Dec 2 '19 at 21:49
  • Put another way: What this more-or-less reads as is a "pleaz give me da code" type post with better spelling. Generally responses to this are negative, as, again, it amounts to someone expecting others to make an effort and do some work when they have not bothered to do anything but it is clear from the context they could. If this is not the case, then you need to think about how to ask more focussed and concrete questions. See stackoverflow.com/help/minimal-reproducible-example and How to Ask Questions the Smart Way. – goldilocks Dec 2 '19 at 21:55