atpost
Posts: 3
Joined: Sat Dec 21, 2019 6:47 am

Re: Image viewer with transition between images

Mon Dec 23, 2019 12:46 pm

Hi Paddy,

I tested with a few pictures, 4, for over 48 hours and all went well.
While slideshow was playing, I added about 2000 pictures to the Pictures folder. The slideshow showed the new pictures without issue. Several hours later I rebooted the pi, and the slideshow won't start anymore.
Thinking that it's because of the large number of pictures, I moved most of the 2000 pictures to a subfolder and only left 3 pictures in the Picture folder - but still no slideshow.

This is the error in the cron log I get since I added the large number of pictures. Still get the error, even after pictures were removed.

Code: Select all

script started
  File "/home/pi/pi3d_demos/PictureFrame.py", line 161
    `    file_list = temp_list_first + temp_list_last
    ^
SyntaxError: invalid syntax
script finished

User avatar
paddyg
Posts: 2501
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Image viewer with transition between images

Mon Dec 23, 2019 2:24 pm

That looks an odd error message. Let me see what the lines around 161 look like in your version of PictureFrame.py, maybe something sneaked in while you were editing. They should be

Code: Select all

    random.shuffle(temp_list_first)
    random.shuffle(temp_list_last)
    file_list = temp_list_first + temp_list_last
  else:
    file_list.sort() # if not suffled; sort by name
i.e. the f of file_list should line up with the r of random. And there shouldn't be any ` characters. (Which might be part of the error message formatting.)

Paddy
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

chris9753
Posts: 8
Joined: Fri Mar 13, 2020 4:37 am

Re: Image viewer with transition between images

Fri Mar 13, 2020 6:02 am

A big thank you to Paddy and others for developing PictureFrame and Pi3d and also to Wolfgang for his organising, motivating and blog. It's a fantastic program and I’ve got it working on a pi3b almost perfectly. The only part not working perfectly is getting it to start automatically and I've tried several ways including crontab and systemd. I have been able to get it to start automatically by informing PictureFrame there is no keyboard connected (unplugging is not enough) but I'm too old fashioned to not have means of attaching a keyboard if needed. I start it with my iPhone or iPad each morning. Takes about a minute....as I said 99% perfect and I'm extremely thankful and grateful!

I may also have found the cause of the two connected conflicts I have: the need to remove the keyboard and not being able to start PictureFrame automatically on reboot. This morning I used my normal terminal command
($ python3 /home/pi/pi3d_demos/PictureFrame.py) to start the display from my ipad but then thought I’d try to autostart again using
ExecStart=/usr/bin/python3 /home/pi/pi3d_demos/PictureFrame.py. As usual it didn’t work but this time I had a different error. PictureFrame started to load but stopped at line 19…Import Pi3d. There is no Pi3d in the Pi3d_demos folder. I did a search on my computer found a Pi3d folder which I had downloaded (no way would PictureFrame have found it) inserted the pathway and although PictureFrame did open it, sadly it created many more conflicts. It did not seem the correct folder/file.

My next thoughts were that since terminal opens PictureFrame perfectly (somehow bypassing the import Pi3d line) I will just delete that line (line 19) by putting a # before it. Unfortunately, this didn’twork either…..but it did get up to about line 142 where the code stated talking about keyboards before crashing again. So my thoughts are that if we can find what the program was meant to import in line 19 (import pi3d) this may work perfectly??? The version of PictureFrame I have came with pi3d-2.17 and was downloaded late September.

As you can tell from this verbose first post (apologies) I’m a relative pi newcomer so I could have accidently deleted something….but I did triple check. I have no idea why PictureFrame opens through terminal but not by autostarting.

I hope this post comes across as thankful and grateful as I am incredibly pleased with my display as is, my intention is just to add my 2 cents worth just in case someone else can make use of it. Thanks again Paddy, Wolfgang et al!

User avatar
paddyg
Posts: 2501
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Image viewer with transition between images

Fri Mar 13, 2020 1:31 pm

Chris, any comments +ve or otherwise are useful. I'm out at moment but will have a look when I get back. Autostart not working is often trying to run from wrong folder, as wrong user, wrong permissions somewhere or at the wrong time (before some dependency has loaded)
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
sapnho
Posts: 227
Joined: Sun Sep 14, 2014 3:49 pm
Location: Frankfurt am Main
Contact: Website

Re: Image viewer with transition between images

Fri Mar 13, 2020 1:49 pm

Glad you like Pi3D, @chris9753. Paddy did an outstanding job, indeed!

Two things you may want to do: Update Pi3D (https://www.thedigitalpictureframe.com/ ... -nov-2019/) It's now on version 2.34.

And as Paddy said, make sure that you did exactly as shown here (https://www.thedigitalpictureframe.com/ ... sing-pi3d/) with regards to the Boot Options.

I never attach a mouse or keyboard to my Pi even during setup, everything is done through the Terminal from another computer. I think your issue may have something to do with the autostart attached to a different user. I guess you checked here already (https://www.thedigitalpictureframe.com/ ... h-systemd/).

If that doesn't work, Paddy usually has (the right) answer to anything shortly.. :-)
www.TheDigitalPictureFrame.com
Build a really great digital picture frame with the Raspberry Pi.
With lots of great tips from this forum.

User avatar
paddyg
Posts: 2501
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Image viewer with transition between images

Fri Mar 13, 2020 10:36 pm

Chris, you will definitely need to have pi3d installed and PictureFrame definitely needs to import it for the program to run. The standard way is to use pip3 as described on Wolfgang's comprehensive instructions. That process 'simply' copies the required files to the standard location on your RPi (/usr/local/lib/python3.7/dist-packages/pi3d/) so that when you put a line in a program ``import pi3d`` it will check the standard location and load all the required apparatus. It is possible to download the module yourself (essentially clone from git or download and unzip from github.com/tipam/pi3d) and the search path can be set in demo.py. However only do this if you want to experiment and do some python coding.

I can't think why the keyboard would make a difference to the autostart but it is quite plausible that it does. The standard keyboard functionality in pi3d uses the python module ``curses`` which depends on the linux ncurses and it can cause issues, for instance if you try to run a program using pi3d from IDLE or other IDEs rather than directly from terminal.

Have a go at using systemd as Wolfgang suggests. I've tried it for other things in the past and struggled but I'm pretty sure Wolfgang will have investigated this pretty thoroughly so it's likely to solve your problems. If not post back here with the results.

Paddy

PS, as of yesterday pi3d is v2.35 - hopefully I've not introduced anything that breaks PictureFrame!
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

chris9753
Posts: 8
Joined: Fri Mar 13, 2020 4:37 am

Re: Image viewer with transition between images

Sat Mar 14, 2020 10:43 am

Wow...amazing responses. Thank you both!

Wolfgang, I have used your blogs extensively and they have been fantastic. The only difficulty I have had is initiating PictureFrame from boot. You’re right, I probably need to update but I’m more than happy with the way it’s working. I have tried your fix using systemd but again PictureFrame crashes on booting. It was after trying your systemd method that I decided to place the ExecStart command straight into terminal. I will describe the effect of this to Paddy as it seems more his area of expertise.

Paddy, I do have Pi3d installed and in the correct place. Because PictureFrame crashed when it hits line 19 (Import Pi3d) I had assumed, incorrectly, that it either wasn’t present or couldn’t be found.

Screenshot 1 shows Pi3d correctly installed…I think
IMG_0005.jpg
IMG_0005.jpg (28.3 KiB) Viewed 566 times
After trying and failing to get Systemd installed (using Wolfgang’s blog) I decided to place the line ExecStart=/usr/bin/python3 /home/pi/pi3d_demos/PictureFrame.py straight into terminal.

This is shown in Screenshot 2.
IMG_0006.jpg
IMG_0006.jpg (16.77 KiB) Viewed 566 times
Screenshot 3 shows the error message I received. I have no idea how to use this information but hopefully it may be useful to you or others.
IMG_0007.jpg
IMG_0007.jpg (23.46 KiB) Viewed 566 times
As pointed out in my original post I am more than happy placing $ python3 /home/pi/pi3d_demos/PictureFrame.py either straight into terminal or via PiHelper on my iPad or iPhone. Also, strangely, everything works perfectly if I disconnect the keyboard using your instructions.

Thanks again!
Chris

User avatar
paddyg
Posts: 2501
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Image viewer with transition between images

Sat Mar 14, 2020 12:18 pm

Chris, that does indeed look very odd! Python sometimes complains that module x isn't installed for various reason (py2 v py3 install, other file with same name in same directory etc.) None of these are applicable because you can run it OK from the terminal. So main culprit would seem to be user. Sometimes autostart seems to run things a root, or pi and if the module was installed using sudo or --user or something else that might cause issues. But that doesn't sound to be your problem because you say it works fine without the keyboard... which narrow the problem down to vanishingly small area. I am busy today and most of tomorrow but I will try to reproduce your problem. Practically it shouldn't be a problem as, long term, you probably won't have the keyboard attached to the RPi running the PictureFrame, but it's frustrating not knowing what the cause is.

Just to clarify (you might have mentioned this but can't spot it now): What RPi are you using. What memory have you allocated. Are you using legacy GPU driver or Fake KMS. When you say disable the keyboard do you mean setting KEYBOARD = False in PictureFrame. Does the problem happen if a keyboard is actually plugged in when the RPi boots.

Paddy
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

chris9753
Posts: 8
Joined: Fri Mar 13, 2020 4:37 am

Re: Image viewer with transition between images

Sat Mar 14, 2020 9:44 pm

Morning Paddy (or is it evening there? I’m in Australia) and thanks again for your amazingly quick response and help.

To answer your questions

The model pi I have is a 3b+
Memory = 128 MB
Driver = legacy GPU (GL driver is disabled)
I have added screenshots to confirm this.
IMG_0014.jpg
IMG_0014.jpg (18.24 KiB) Viewed 524 times
IMG_0016.jpg
IMG_0016.jpg (33.7 KiB) Viewed 524 times
Disabled Keyboard = I did not use setting keyboard = False. The way I disabled the keyboard was by commenting out certain lines in PictureFrame. This was originally suggested by you as a possible solution (thanks again) in this thread (page 9, 21/12/19) and more fully explained (the steps I followed) by atpost in the following post. If I disable the keyboard using this technique everything works perfectly.

If I have a keyboard plugged in, reboot, the problem persists. If I remove the keyboard, reboot (control the pi by either pihelper from ipad or SSH from mac), the problem persists. The only way I have found to get the program working perfectly is to comment out the keyboard using the method described above.

The only “unusual” aspect of using my method to start (python3 /home/pi/pi3d_demos/PictureFrame.py directly into terminal) is that terminal adds b’GLES2’ before carrying out the command. I have shown this in a screenshot.
IMG_0017.jpg
IMG_0017.jpg (16.21 KiB) Viewed 524 times
Thanks again Paddy for all your help.
Chris

chris9753
Posts: 8
Joined: Fri Mar 13, 2020 4:37 am

Re: Image viewer with transition between images

Sat Mar 14, 2020 10:12 pm

sapnho wrote:
Fri Mar 13, 2020 1:49 pm
I guess you checked here already (https://www.thedigitalpictureframe.com/ ... h-systemd/).
Thanks again Wolfgang and yes I have tried to implement this. I was able to correctly install the file, and change permissions but I was unable to enable it due to it being a bad message? I have attached screenshots to show this. In the script the PictureFrame did have a .py attached, I accidently cut it off when I took the screenshot.
IMG_0010.jpg
IMG_0010.jpg (34.35 KiB) Viewed 514 times
IMG_0013.jpg
IMG_0013.jpg (27.22 KiB) Viewed 514 times
I hope I'm not coming across as too demanding, as stated previously I'm incredibly pleased with the program. Even if a solution is found I will probably continue to start using my iPad. I'm just trying to help others by making a very small contribution to add to the amazing work you, paddy and others do.

Thanks again,
Chris

chris9753
Posts: 8
Joined: Fri Mar 13, 2020 4:37 am

Re: Image viewer with transition between images

Sat Mar 14, 2020 11:16 pm

paddyg wrote:
Sat Mar 14, 2020 12:18 pm
Practically it shouldn't be a problem as, long term, you probably won't have the keyboard attached to the RPi running the PictureFrame, but it's frustrating not knowing what the cause is.

Hi again Paddy,

I won’t have the keyboard physically attached but I won’t disable it either by commenting out the appropriate lines in PIctureFrame using the previously described method. This means that the problem will persist but again stressing, that for me, it’s a very minor problem. I’m more than happy to control the program with my iPad or mac.

The reason I won’t is that when I did disable it completely, and although the program worked perfectly, I was unable to get out of it and reconnect the keyboard. If I rebooted it went straight back into the slideshow. This was a couple of months ago and although my programming/script/skills are weak they were much weaker then. In the end I just removed the SD card, wiped it and did a full reinstall. I’m sure that there are much easier ways!!

Could I have just killed PictureFrame or python, physically re-attached the keyboard and removed the marks from PictureFrame that had previously commented the keyboard out??? Or even easier have two PictureFrame scripts, one with keyboard attached, one with it disabled and then just switch between the two depending on my needs?? If I did this what commands would I write into terminal (using ssh on my mac or iPad) to kill PictureFrame and/or python and get back to the desktop gui??

Something for me to play with one day perhaps but, as stated previously, I’m more than happy just starting it with my iPad at the moment.

Thanks again,
Chris

User avatar
paddyg
Posts: 2501
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Image viewer with transition between images

Sun Mar 15, 2020 12:05 am

Chris, lots of info (great) which I will read properly later but just a quick note: If I start python apps running on a RPi without a keyboard I usually:

Code: Select all

- ssh in to it
- run ``top`` from the terminal prompt
- make a note of the ID (left hand column) for the line with python3 as the name of the job
- quit top by pressing q
- sudo kill 43512 #or whatever the ID is I noted down
Also if you take the SD card out you can actually put it into your PC and edit the files directly i.e. to stop the autoboot functionality (there may be some access limitations, depending on what OS is on your PC)

Paddy
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

chris9753
Posts: 8
Joined: Fri Mar 13, 2020 4:37 am

Re: Image viewer with transition between images

Sun Mar 15, 2020 3:11 am

paddyg wrote:
Sun Mar 15, 2020 12:05 am
Chris, lots of info (great) which I will read properly later but just a quick note: If I start python apps running on a RPi without a keyboard I usually:

Code: Select all

- ssh in to it
- run ``top`` from the terminal prompt
- make a note of the ID (left hand column) for the line with python3 as the name of the job
- quit top by pressing q
- sudo kill 43512 #or whatever the ID is I noted down
Paddy
Thanks Paddy, that worked perfectly. I'm much more confident disconnecting my keyboard now and relying on ssh.

As an aside, I thought I had a brainwave and had discovered another, easier work around for this problem. Sadly, it didn't work. When I put python3 /home/pi/pi3d_demos/PictureFrame.py into terminal, terminal adds b’GLES2’ and it works perfectly. My plan was to follow Wolfgang's instructions for setting up a crontab but add b’GLES2’ at the end. That would mean my pi would receive exactly the same input as i was putting in terminal. I've shown this the screenshot below. Sadly, PI3D didn't launch automatically at reboot. The best laid plans ....
IMG_0002.jpg
IMG_0002.jpg (18.74 KiB) Viewed 465 times
Thanks again for your help,
Chris

chris9753
Posts: 8
Joined: Fri Mar 13, 2020 4:37 am

Re: Image viewer with transition between images

Sun Mar 15, 2020 11:05 pm

OK I think I’m all sorted. I ended up with two problems, one I managed to solve with help from here, and the other, I managed to solve with a solution I hadn’t seen mentioned before.

Problem 1 – Was the keyboard conflict and the solution to this was discussed in a previous post. However, when I implemented this solution, it didn’t work. This surprised me as this solution had been successful in the past. The chron.log (shown below) introduced me to the second problem.
IMG_0003.jpg
IMG_0003.jpg (26.06 KiB) Viewed 412 times
Problem 2 – I hadn’t touched my digital display (then working) for about a month as I set about building a frame, organizing an electrician to install power points, painting the bathroom etc. During that time the only change I could recall making was taking the picture folder from the SD card containing the Rasbian image, transferring it to an external usb memory stick and attaching it to the pi with a 1 metre lead. This was so I had easy access to add/remove/edit the photos I was displaying. I suspected this introduced a time delay which interfered with the working of crontab. I knew my start_slideshow.sh executed so that wasn’t the problem. But that got me thinking, why did I need a slideshow script at all, why couldn’t I start Pi3d/PictureFrame directly from the crontab? I then deleted the start slideshow script and entered start pi3d/pictureframe directly into the crontab.
IMG_0004.jpg
IMG_0004.jpg (20.33 KiB) Viewed 412 times
After I did this it worked perfectly. I still get a slight error, due to I think, an extra forward slash after PictureFrame.py but as it works perfectly I haven’t bothered to change this. I also commented back in the keyboard to see if this solution solved my original problem. It didn’t….that’s what makes me think there were two separate problems.
IMG_0006.jpg
IMG_0006.jpg (30.25 KiB) Viewed 412 times
You may notice the extra power point next to my display, this is because my house is fairly open plan and this is the only vertical wall with space I have. I would like two displays so I am about to begin this process all over again. Hopefully, it will be a lot easier and faster second time around.

Again apologies for the verboseness of these posts, but I know how much I appreciated detail when I began this journey.

And finally another big thank you to Wolfgang and Paddy for their unbelievable generosity and incredible knowledge. And Wolfgang, apologies but I had to try and imitate the “jumping” picture from your blog.

Chris

User avatar
sapnho
Posts: 227
Joined: Sun Sep 14, 2014 3:49 pm
Location: Frankfurt am Main
Contact: Website

Re: Image viewer with transition between images

Mon Mar 16, 2020 5:57 am

Hi Chris, that's great news!!

Would you mind sending me a few high res photos of your frame in action, especially how you integrated it into your house setting? I am compiling user feedback on the digital frame that they have built to inspire others. Email is on my blog. Thanks much!
www.TheDigitalPictureFrame.com
Build a really great digital picture frame with the Raspberry Pi.
With lots of great tips from this forum.

start78
Posts: 43
Joined: Mon May 23, 2016 8:02 am
Location: Germany

Re: Image viewer with transition between images

Mon Mar 16, 2020 3:15 pm

Hello,

is it possible to write-protect the sd-card after setting everything up? My plan is to use the image viewer in a shop-environment (behind a tv screen) where the main power will be switched off for the night. I want to prevent damages to the image.

(Hallo Wolfgang, wir sind gar nicht so weit voneinander entfernt. Gibt es Einwände, wenn ich Deine Arbeit quasi kommerziell nutzen möchte?)

User avatar
sapnho
Posts: 227
Joined: Sun Sep 14, 2014 3:49 pm
Location: Frankfurt am Main
Contact: Website

Re: Image viewer with transition between images

Mon Mar 16, 2020 3:23 pm

is it possible to write-protect the sd-card after setting everything up? My plan is to use the image viewer in a shop-environment (behind a tv screen) where the main power will be switched off for the night. I want to prevent damages to the image.
There are log files written all the times, so this won't work. Use an industrial strength SD card and keep a backup, that's probably the easiest option.
(Hallo Wolfgang, wir sind gar nicht so weit voneinander entfernt. Gibt es Einwände, wenn ich Deine Arbeit quasi kommerziell nutzen möchte?)
Ist ja nicht "meine" Arbeit, sondern alles public domain, was wir hier machen. Ich freue mich, wenn die Lösungen eingesetzt werden.
www.TheDigitalPictureFrame.com
Build a really great digital picture frame with the Raspberry Pi.
With lots of great tips from this forum.

User avatar
paddyg
Posts: 2501
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Image viewer with transition between images

Mon Mar 16, 2020 4:39 pm

Also something here https://medium.com/@andreas.schallwig/h ... c0f7be7353 that might be helpful (diverting logging etc to tmpfs etc) in prolonging SD card life and avoiding corruption.
PS not tried any of this so it would be interesting to hear if/how it works with python and PictureFrame
PPS pi3d subscribes to the MIT license which pretty much says you can do what you want with it but has the potential issue, that you have to pass that on to your customers if you include modified versions of it in your code.
Last edited by paddyg on Mon Mar 16, 2020 4:58 pm, edited 1 time in total.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
sapnho
Posts: 227
Joined: Sun Sep 14, 2014 3:49 pm
Location: Frankfurt am Main
Contact: Website

Re: Image viewer with transition between images

Mon Mar 16, 2020 4:45 pm

Amazing, I wouldn't have thought that this is possible! He even updated his article for Buster: https://medium.com/swlh/make-your-raspb ... 558694de79
www.TheDigitalPictureFrame.com
Build a really great digital picture frame with the Raspberry Pi.
With lots of great tips from this forum.

chris9753
Posts: 8
Joined: Fri Mar 13, 2020 4:37 am

Re: Image viewer with transition between images

Mon Mar 16, 2020 11:17 pm

sapnho wrote:
Mon Mar 16, 2020 5:57 am
Would you mind sending me a few high res photos of your frame in action, especially how you integrated it into your house setting? I am compiling user feedback on the digital frame that they have built to inspire others. Email is on my blog. Thanks much!
Some photos have been sent Wolfgang. Not 100% sure exactly what you were after so if you were interested in something else let me know. My frame's fairly secularly attached to the wall and not easy to remove. The top is open both to allow heat to escape and to allow me ready access via a variety of means. I've tried to show this in the photo below.

Chris
DigitalDisplay4.jpg
DigitalDisplay4.jpg (31.95 KiB) Viewed 315 times

Return to “General discussion”