Go to advanced search

by paddyg
Fri Jan 10, 2020 12:03 am
Forum: Python
Topic: Need help installing MQTT using these python commands
Replies: 9
Views: 440

Re: Need help installing MQTT using these python commands

This seems to work ok i.e. client = mqtt.Client() creates an instance of the mqtt.Client class which can subsequently be used (set id and pw then connect etc). Passing args as client_name will assume it's the first arg i.e. client_id so you have to set that variable correctly.
by paddyg
Thu Jan 09, 2020 11:56 pm
Forum: Python
Topic: Classes and For Loops
Replies: 9
Views: 532

Re: Classes and For Loops

You can start at the other end of the list

Code: Select all

for number in numbers[::-1]:
and it *seems* to behave. However I'm not sure I would trust it in all circumstance!
by paddyg
Thu Jan 09, 2020 9:44 pm
Forum: Python
Topic: picamera and EXIF Tags-Solved
Replies: 5
Views: 346

Re: picamera and EXIF Tags-Solved

Yes, @scruss is probably right. I think I wouldn't save the image but capture to numpy array then convert to PIL Image . I don't know if that will then have exif editing available (or if it's tied up with jpeg). I check it out later if I get chance. Paddy PS I think reading the exif info is a lazy o...
by paddyg
Sat Jan 04, 2020 1:48 pm
Forum: Python
Topic: Raspberry Snake in Python 2--Game not working, Unknown Error
Replies: 4
Views: 512

Re: Raspberry Snake in Python 2--Game not working, Unknown Error

As of last Tuesday night python2 has reached end of life, so unless you have a burning need to use it I would suggest switching to python3. I don't have the exact code you're using but I found an approximation to the listing below elsewhere on this forum and it seems to work on this laptop with pyth...
by paddyg
Sat Jan 04, 2020 9:00 am
Forum: Python
Topic: Python library to get EXIF tags from camera?
Replies: 6
Views: 655

Re: Python library to get EXIF tags from camera?

PIL which is actually Pillow and installed on default raspbian can get most exif data pretty well. Here is a rather complicated demo but the actual exif bit is quite simple. https://github.com/pi3d/pi3d_demos/blob/master/PictureFrame.py around line 139 and 166. The version of Pillow on buster is qui...
by paddyg
Mon Dec 30, 2019 8:41 am
Forum: Python
Topic: rewrite value in specific column csv file
Replies: 6
Views: 297

Re: rewrite value in specific column csv file

You can read and write into the middle of a file but you would have to have a scheme for keeping track of the data in a structured form. That's what a db would do for you. If it's only a small amount of data read and write it into a variable using pickle or json. Or csv as suggested.
by paddyg
Sun Dec 29, 2019 9:36 am
Forum: Gaming
Topic: R-Pi Massively Multiplayer Online Role-Playing Games (MMORPG)
Replies: 312
Views: 90915

Re: R-Pi Massively Multiplayer Online Role-Playing Games (MMORPG)

Components still there but it needs an enthusiastic ringleader.
by paddyg
Mon Dec 23, 2019 2:24 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 244
Views: 43789

Re: Image viewer with transition between images

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 random.shuffle(temp_list_first) random.shuffle(temp_list_last) file_list = temp_list_first + temp_list_last else: file...
by paddyg
Sat Dec 21, 2019 3:26 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 244
Views: 43789

Re: Image viewer with transition between images

Glad you got it working and glad you like it. That glGetError 0x500 means that at some point (prior to the previous call to glGetError()) an instruction to the GPU used an invalid enumerant. That translates as meaning one of the values passed to one of the OpenGL(ES) function didn't match whatever i...
by paddyg
Sat Dec 21, 2019 2:02 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 244
Views: 43789

Re: Image viewer with transition between images

@atpost, It looks to be the keyboard input that's causing the problem (it uses curses - good name!). I meant to make that optional in the last release but it must have slipped through. In the mean time you can comment out the keyboard stuff like this (this is a 'diff' showing just what changes befor...
by paddyg
Fri Dec 20, 2019 11:47 am
Forum: Graphics programming
Topic: Pi3D transparent background on Pi4
Replies: 88
Views: 10612

Re: Pi3D transparent background on Pi4

Hi, yes the 'layer' options is specifically the dispmanx layer so I wouldn't expect it to have any effect unless using the bcm drivers (aka legacy) on the RPis prior to v4. When you test your code on the RPi3 are your using fake KMS? As we discussed back on page 1/2 of this thread it would be nice t...
by paddyg
Sun Dec 15, 2019 8:22 am
Forum: Python
Topic: write and running python programs on windows
Replies: 4
Views: 357

Re: write and running python programs on windows

Yes I think there are a few and I would suggest googling. The first one I found was called fake_pi
by paddyg
Fri Dec 13, 2019 6:16 pm
Forum: Python
Topic: Webinterface - FLASK and while loop
Replies: 2
Views: 377

Re: Webinterface - FLASK and while loop

Do you need to set the global light_on True? You might need to put your actions into functions and run them in threads to stop the whole thing getting stuck in a flashing light loop. I think you have to put global as the first line of the function. Finally I think you can pass a list to gpio.setup s...
by paddyg
Wed Dec 11, 2019 6:50 pm
Forum: Python
Topic: Python script stops after 1 minute after boot
Replies: 5
Views: 362

Re: Python script stops after 1 minute after boot

So it's quite an obvious problem - once you know what it is! I just tried your code on my RPi and (after I struggled to get the internal pull-up to work at all, not sure what that's about. More investigation needed) I had exactly your problem. Then when I tried typing the mpg123 etc on the command l...
by paddyg
Wed Dec 11, 2019 8:38 am
Forum: Python
Topic: Render pi3d over omxplayer on pi4
Replies: 3
Views: 326

Re: Render pi3d over omxplayer on pi4

@pescew Glad that you seem to be able to find a way round the issue; I was going to suggest VLC or suchlike. I think everything (including omxplayer) uses ffmpeg inside (it's a very comprehensive, handy library) so you probably always get that, but it probably cuts out a bit of processing overhead t...
by paddyg
Tue Dec 10, 2019 11:43 pm
Forum: Python
Topic: trouble with gpiozero
Replies: 1
Views: 146

Re: trouble with gpiozero

https://gpiozero.readthedocs.io/en/stab ... t.html#led i.e. my_led.is_lit will be a boolean value (it is a function but it's hidden behind a decorator so that it behaves like a property (all things to google if they're not familiar))
by paddyg
Tue Dec 10, 2019 11:37 pm
Forum: Python
Topic: Threading problems
Replies: 18
Views: 1040

Re: Threading problems

OK the best thing I can suggest is that you take all your gui modifying code out of threads. You can leave you structure in functions but move master refs to a new non threaded GUI function def time_dependent_activities(): global val_1 if (tm_second == 10 or tm_second == 20): val_1 = val_1 + 255 if ...
by paddyg
Tue Dec 10, 2019 10:45 pm
Forum: Python
Topic: Render pi3d over omxplayer on pi4
Replies: 3
Views: 326

Re: Render pi3d over omxplayer on pi4

Ages since I've looked at omxplayer. Does it have an option to make it play in an X11 window? It sounds like it's playing directly to dispmanx and it's no longer possible (well not very easy - aka I don't know how) to run OpenGL to dispanx. I will have a look around and see what I can find - doesn't...
by paddyg
Tue Dec 10, 2019 10:14 pm
Forum: Python
Topic: Python script stops after 1 minute after boot
Replies: 5
Views: 362

Re: Python script stops after 1 minute after boot

I can't see why it would cause the program to stop but you should have a small sleep in you main while loop. Even time.sleep(0.1) will cut CPU from 100% to 1%. Does the program run indefinitely if you don't press either button to start the audio? Can you switch audio any number of times by pressing ...
by paddyg
Tue Dec 10, 2019 9:56 pm
Forum: Python
Topic: Loop () Code Structure
Replies: 3
Views: 283

Re: Loop () Code Structure

@rebthetractorma, well done for getting it working. It sounds a really interesting project and it would be good to share your ideas with others in the same position. I definitely don't want to pour cold water on your enthusiasm but the system does need to be fail-safe. i.e. if it goes wrong the resu...
by paddyg
Mon Dec 09, 2019 10:50 am
Forum: General discussion
Topic: RPI 4B 1GB Xinit keeps stopping; running out of options...
Replies: 7
Views: 568

Re: RPI 4B 1GB Xinit keeps stopping; running out of options...

@basm, well at least there's some info being fed back. The error message looks like memory allocation running 4K see https://www.raspberrypi.org/forums/viewtopic.php?t=246443&start=25 and others. However I think Wolfgang has run the PictureFrame app at 4K without it crashing - I don't know what RAM ...
by paddyg
Sun Dec 08, 2019 7:20 pm
Forum: Python
Topic: Loop () Code Structure
Replies: 3
Views: 283

Re: Loop () Code Structure

Is there a reason you need to run your subfiles in that rather non-standard way? Normally you would import the subfile once at the start of main and have a function with a loop in subfile that would check for input and stop accordingly. Maybe if you give some more info about what you're trying to do...
by paddyg
Sun Dec 08, 2019 6:20 pm
Forum: Python
Topic: Parent script termination
Replies: 17
Views: 1000

Re: Parent script termination

To be fair, in your first reply you were pretty explicit about the OP needing to put the functionality in the imported file into functions, then importing the file only once and calling the functions in the parent program (at the point where the OP was trying to do repeated imports).
by paddyg
Sun Dec 08, 2019 8:25 am
Forum: Python
Topic: Parent script termination
Replies: 17
Views: 1000

Re: Parent script termination

I would reiterate scotty101 here you should not be attempting to use subprocess or to "execute" a child python script for this.
by paddyg
Sat Dec 07, 2019 11:11 pm
Forum: Python
Topic: How to stop mp3 from playing if another GPIO button is pushed
Replies: 2
Views: 206

Re: How to stop mp3 from playing if another GPIO button is pushed

if you start mpg123 with the --remote option then you can pass commands via stdin i.e. @H LOAD/L <trackname>: load and start playing resource <trackname> @H LOADPAUSED/LP <trackname>: load but do not start playing resource <trackname> @H LOADLIST/LL <entry> <url>: load a playlist from given <url>, a...

Go to advanced search