Go to advanced search

by croston
Wed Feb 10, 2021 11:31 am
Forum: Python
Topic: Flask App Structure
Replies: 15
Views: 818

Re: Flask App Structure

I'm glad you have got it working. At least it was a simple fix in the end and not a rewrite. I hope you managed to learn more about how it all works - after all, that's one of the main reasons RPi exists!

Have fun with your final project!
by croston
Tue Feb 09, 2021 4:27 pm
Forum: Beginners
Topic: Toggling Pi4 GPIO Outputs with Python?
Replies: 16
Views: 738

Re: Toggling Pi4 GPIO Outputs with Python?

Sadly, for me however, raspi-gpio doesn't have a "toggle" output option either, only 'drive high' or 'drive low', so I can't use it on my Desktop icon mentioned above. How frustrating It shouldn't take much code to read the current state of the pin and invert it. You could do it in bash o...
by croston
Tue Feb 09, 2021 11:49 am
Forum: Python
Topic: Flask App Structure
Replies: 15
Views: 818

Re: Flask App Structure

Using 'flask run' is why the code change didn't work in this case - your code is being imported as a module and not run as a main program, therefore not executing 'app.run(...)'. This is likely to be closer to real world use in production. It still seems like there a port number conflict somewhere o...
by croston
Tue Feb 09, 2021 10:39 am
Forum: Python
Topic: Flask App Structure
Replies: 15
Views: 818

Re: Flask App Structure

You could try:

Code: Select all

app.run(host='0.0.0.0', port=5000, debug=True, use_reloader=True)
to see if you get any more information.
by croston
Tue Feb 09, 2021 12:30 am
Forum: Beginners
Topic: Toggling Pi4 GPIO Outputs with Python?
Replies: 16
Views: 738

Re: Toggling Pi4 GPIO Outputs with Python?

Code: Select all

def toggle(chan):
    GPIO.output(chan, not GPIO.input(chan))
by croston
Mon Feb 08, 2021 7:44 pm
Forum: Python
Topic: Flask App Structure
Replies: 15
Views: 818

Re: Flask App Structure

In the index() function ('/' route), where does the object 'form' get defined before it is used by this line of code? return render_template('index.html', form=form, Status=Status) Edit: re-read your original post and realised you have cut out the code where this is defined in your snippet. My other...
by croston
Sun Oct 25, 2020 12:34 pm
Forum: Ubuntu
Topic: Installation of RPI.GPIO failure on Pi4 running Ubuntu 20.10 Desktop
Replies: 16
Views: 4035

Re: Installation of RPI.GPIO failure on Pi4 running Ubuntu 20.10 Desktop

Does it work when you run your script using sudo? If so, this points to problems with permissions, or the lack of /dev/gpiomem.
by croston
Sat Oct 24, 2020 10:01 am
Forum: Ubuntu
Topic: Installation of RPI.GPIO failure on Pi4 running Ubuntu 20.10 Desktop
Replies: 16
Views: 4035

Re: Installation of RPI.GPIO failure on Pi4 running Ubuntu 20.10 Desktop

I've discovered a possible solution from someone running Ubuntu 20.04. Ubuntu doesn't have permissions set correctly for GPIO and RPi.GPIO gives a misleading error message about not running on a RPi. I haven't tested this myself. Create /etc/udev/rules.d/90-gpio.rules with: KERNEL=="gpiomem&quo...
by croston
Fri Oct 23, 2020 6:01 pm
Forum: Ubuntu
Topic: Installation of RPI.GPIO failure on Pi4 running Ubuntu 20.10 Desktop
Replies: 16
Views: 4035

Re: Installation of RPI.GPIO failure on Pi4 running Ubuntu 20.10 Desktop

Try this as a workaround:

Code: Select all

export CFLAGS=-fcommon
pip3 install RPi.GPIO
(I haven't tested this)
by croston
Fri Oct 23, 2020 5:29 pm
Forum: Ubuntu
Topic: Installation of RPI.GPIO failure on Pi4 running Ubuntu 20.10 Desktop
Replies: 16
Views: 4035

Re: Installation of RPI.GPIO failure on Pi4 running Ubuntu 20.10 Desktop

What version of gcc is it using? I'm in the process of fixing failing builds with gcc 10.
by croston
Wed Sep 02, 2020 6:11 pm
Forum: General discussion
Topic: How to build Python 3.8 on raspbian stretch (problems with pip and openssl)?
Replies: 10
Views: 3021

Re: How to build Python 3.8 on raspbian stretch (problems with pip and openssl)?

According to your log file, the installation of all the dependencies was aborted.
by croston
Wed Sep 02, 2020 4:21 pm
Forum: General discussion
Topic: How to build Python 3.8 on raspbian stretch (problems with pip and openssl)?
Replies: 10
Views: 3021

Re: How to build Python 3.8 on raspbian stretch (problems with pip and openssl)?

If you have a log of running the script, it would be useful. The bit I am most interested in is installing the dependencies. Did you do an apt update and a apt full-upgrade before running it?
by croston
Tue Sep 01, 2020 4:29 pm
Forum: General discussion
Topic: How to build Python 3.8 on raspbian stretch (problems with pip and openssl)?
Replies: 10
Views: 3021

Re: How to build Python 3.8 on raspbian stretch (problems with pip and openssl)?

I am the original author of the shell script you are using to build and compile Python 3.8.5. It should install all the dependencies necessary for the missing modules - this has worked for me between major releases of Raspbian and Python 3 over several years. Are you sure that the development packag...
by croston
Sat Aug 15, 2020 1:00 pm
Forum: Beginners
Topic: Print raw data to label printer from python2 not working as expected.
Replies: 14
Views: 5564

Re: Print raw data to label printer from python2 not working as expected.

Have you run 'AutoSense' to detect and set the label size on your printer? There is an EPL2 command to do this or you can hold the 'feed' button when powering on. Alternatively, there are EPL2 commands ('q' and 'Q') to manually configure the label size and spacing. I'm afraid that I don't know the e...
by croston
Sun Jul 19, 2020 8:12 am
Forum: Python
Topic: How to tell if a GPIO channel is in use?
Replies: 8
Views: 496

Re: How to tell if a GPIO channel is in use?

A channel that is 'cleaned up' is set to be an input, pull up/down registers set to 'none' and is not exported in /sys/class/gpio.
by croston
Tue Jun 02, 2020 9:03 pm
Forum: Troubleshooting
Topic: RPI.GPIO and Pi4 issue ?
Replies: 20
Views: 8997

Re: RPI.GPIO and Pi4 issue ?

Thanks - I'll take a look at this. I've got to check RPi.GPIO behaves properly with the new foundation maintained arm64 distro anyway. I've a couple of compiler warnings with Python 3.9.0b1 to clear up too.
by croston
Mon Mar 09, 2020 6:16 pm
Forum: Networking and servers
Topic: Best resources and tutorials for configuring an email server
Replies: 2
Views: 656

Re: Best resources and tutorials for configuring an email server

Although not RPi specific, this guide for Debian has served me well. https://workaround.org/ispmail
by croston
Sat Feb 15, 2020 3:21 pm
Forum: General discussion
Topic: STRANGE -- make changes - reboot - changes are gone!???
Replies: 10
Views: 1069

Re: STRANGE -- make changes - reboot - changes are gone!???

I've had something similar happen before. Turned out that it was a strange SD card fault. Clone your SD card and it will probably be OK on the new one.
by croston
Mon Oct 07, 2019 6:40 am
Forum: Python
Topic: Syntax of add_header
Replies: 9
Views: 1299

Re: Syntax of add_header

The line in question is using 'f strings'. This was only introduced to the language in Python 3.6. What version of Python are you using? If you are using Python3 on Raspbian Stretch then you are only using Python 3.5. Either switch to Raspbian Buster or manually install the latest version of Python....
by croston
Mon Aug 26, 2019 11:25 pm
Forum: Troubleshooting
Topic: RPI.GPIO and Pi4 issue ?
Replies: 20
Views: 8997

Re: RPI.GPIO and Pi4 issue ?

This fix is now in Raspbian Buster if you run an update:

Code: Select all

sudo apt update && sudo apt full-upgrade
by croston
Thu Aug 15, 2019 6:37 pm
Forum: Beginners
Topic: Print raw data to label printer from python2 not working as expected.
Replies: 14
Views: 5564

Re: Print raw data to label printer from python2 not working as expected.

To install the lpr command:

Code: Select all

sudo apt install cups-bsd
by croston
Mon Jul 08, 2019 5:13 pm
Forum: Troubleshooting
Topic: RPI.GPIO and Pi4 issue ?
Replies: 20
Views: 8997

Re: RPI.GPIO and Pi4 issue ?

You can now install the alpha release (for testing purposes):

Code: Select all

$ pip3 install --upgrade --pre rpi.gpio
Let me know if it works or not.
by croston
Thu Jul 04, 2019 6:56 pm
Forum: Troubleshooting
Topic: RPI.GPIO and Pi4 issue ?
Replies: 20
Views: 8997

Re: RPI.GPIO and Pi4 issue ?

I'm looking at a fix being available on Sunday.

Go to advanced search