Go to advanced search

by croston
Sun Nov 04, 2018 4:55 pm
Forum: Beginners
Topic: Exceptions on threading
Replies: 2
Views: 527

Re: Exceptions on threading

It's because you are using GPIO.setmode(...), GPIO.setup(...) and GPIO.cleanup() in your thread. Move these to the beginning and end of your main program.
by croston
Sun Nov 04, 2018 1:15 pm
Forum: Troubleshooting
Topic: [SOLVED] gpiozero Button - Runtime Error - edge detection
Replies: 19
Views: 4360

Re: gpiozero Button - Runtime Error - edge detection

neilgl wrote:
Sun Nov 04, 2018 12:56 pm
The GPIO.VERSION now shown is 0.6.4 - should it be that?
That's what it will report on the development version because I haven't changed it to report anything else yet.
by croston
Sat Nov 03, 2018 10:49 pm
Forum: Troubleshooting
Topic: cannot install rpi.gpio on raspbian lite stretch
Replies: 2
Views: 767

Re: cannot install rpi.gpio on raspbian lite stretch

You have installed the debug package by accident. To remove it:

Code: Select all

$ sudo apt-get remove 
python-rpi.gpio-dbgsym python3-rpi.gpio-dbgsym
by croston
Sat Nov 03, 2018 9:13 pm
Forum: Troubleshooting
Topic: [SOLVED] gpiozero Button - Runtime Error - edge detection
Replies: 19
Views: 4360

Re: gpiozero Button - Runtime Error - edge detection

I think I've fixed it in the latest development RPi.GPIO. It turns out that the GPIOs weren't getting cleaned up properly under Thonny and a recent bugfix to RPi.GPIO unmasked the problem. I will release RPi.GPIO 0.6.5 in the next few days. If you can't wait that long then install the latest develop...
by croston
Sat Nov 03, 2018 5:10 pm
Forum: Troubleshooting
Topic: [SOLVED] gpiozero Button - Runtime Error - edge detection
Replies: 19
Views: 4360

Re: gpiozero Button - Runtime Error - edge detection

Ive managed to reproduce the problem with Thonny now. How are you stopping your code from running?
by croston
Sat Nov 03, 2018 3:58 pm
Forum: Troubleshooting
Topic: [SOLVED] gpiozero Button - Runtime Error - edge detection
Replies: 19
Views: 4360

Re: gpiozero Button - Runtime Error - edge detection

I've been trying all week to reproduce this problem - no luck so far.
by croston
Thu Nov 01, 2018 1:54 pm
Forum: Troubleshooting
Topic: GPIO Python Script Restart: Failed to add edge detection
Replies: 3
Views: 1230

Re: GPIO Python Script Restart: Failed to add edge detection

I'm aware of this problem and working on a fix.
by croston
Tue Feb 06, 2018 8:25 pm
Forum: General discussion
Topic: What's wrong with my sqlite-python code?
Replies: 5
Views: 874

Re: What's wrong with my sqlite-python code?

The last two lines of code:

Code: Select all

conn.commit
conn.close
are missing brackets therefore it does not call these functions.

In others words it should be:

Code: Select all

conn.commit()
conn.close()
by croston
Sat Jan 06, 2018 6:50 pm
Forum: Beginners
Topic: Print raw data to label printer from python2 not working as expected.
Replies: 9
Views: 3866

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

I am the author of the zebra Python module: https://pypi.python.org/pypi/zebra/ It is basic and only uses EPL2, not ZPL but I think it would be useful for you to look at the code to see how it works. Source is at https://www.wyre-it.co.uk/hg/zebra/file/tip/zebra.py I haven't touched it in nearly thr...
by croston
Fri Nov 10, 2017 12:43 pm
Forum: Python
Topic: idle in virtual environment
Replies: 6
Views: 3235

Re: idle in virtual environment

BTW, I was also misinformed by SO, It says to use pip3 install RPi.GPIO, actually, I used pip install RPi.GPIO in the virtual environment than it works. However I am not very clear on this, isn't pip is only for python 2 and pip3 is for python3? When creating a python virtual environment, you are s...
by croston
Mon Nov 06, 2017 12:36 pm
Forum: Python
Topic: Building RPi.GPIO module
Replies: 1
Views: 546

Re: Building RPi.GPIO module

If you have built Python 3.6 from source then it is as simple as :

Code: Select all

# pip3 install RPi.GPIO
Note that edge detection will probably not work as it depends on /sys/class/* provided by the Linux kernel.

I don't know FreeBSD at all. Does it provide /dev/mem? RPi.GPIO needs this too.
by croston
Sun Nov 05, 2017 10:16 am
Forum: Weather station
Topic: Help with python scratch module
Replies: 13
Views: 3781

Re: Help with python scratch module

I am the author of the 'scratch' python module. It is currently released as an alpha release. This means that you need to add the --pre flag to install it with pip. I did the release over five years ago now so I think it is long overdue in changing from alpha to production status! My apologies to e...
by croston
Sun Sep 24, 2017 10:10 am
Forum: Weather station
Topic: Troubles installing Stretched Raspbian
Replies: 29
Views: 4602

Re: Troubles installing Stretched Raspbian

Obligatory XKCD:
https://xkcd.com/149/
by croston
Thu Aug 17, 2017 12:49 pm
Forum: General discussion
Topic: Raspbian Stretch (9.1) has arrived !!
Replies: 129
Views: 40728

Re: Raspbian Stretch (9.1) has arrived !!

Martin Frezman wrote:
Thu Aug 17, 2017 12:47 pm
runboy93 wrote:
Thu Aug 17, 2017 11:02 am
Fresh image is always less risk.
If you don't care about your data or installed programs.
It's a good way to test your backups are fit for purpose.
by croston
Wed Aug 16, 2017 7:40 pm
Forum: Troubleshooting
Topic: Activating virtual environment in cron
Replies: 3
Views: 3562

Re: Activating virtual environment in cron

This might work:

Code: Select all

30 12 * * 1-5 /home/pi/myvenv/bin/python script.py
I'm not at a computer to test at the moment but I think this is what has worked for me before.
by croston
Sun Jul 30, 2017 2:19 pm
Forum: Python
Topic: Help! SyntaxError: Invalid Syntax
Replies: 2
Views: 1268

Re: Help! SyntaxError: Invalid Syntax

What version of Python are you using? F-strings are only available in Python 3.6 onwards. F-strings replace the use of '.format' that you are also using.
by croston
Thu Jul 27, 2017 11:45 pm
Forum: Python
Topic: Invalid syntax
Replies: 1
Views: 616

Re: Invalid syntax

It's missing a closing bracket on the line above.

Lesson: when you get an error on a lime of code, the mistake is often found on the line above.
by croston
Sun Jul 23, 2017 4:06 pm
Forum: Beginners
Topic: Dumb python newbie question
Replies: 12
Views: 1981

Re: Dumb python newbie question

Python 3 was released back in Feb 2009. It is very much mature. Python 2 support will end in 2020.
See the countdown timer at https://pythonclock.org.

The main problem these days is that there are a lot of examples and tutorials left lying around the web that still use Python 2.
by croston
Sun Jul 23, 2017 7:48 am
Forum: General discussion
Topic: Executable file
Replies: 12
Views: 2266

Re: Executable file

It is possible that removable media is being automatically mounted with the 'noexec' flag set.
by croston
Thu Jul 20, 2017 6:41 pm
Forum: Beginners
Topic: RPi.GPIO question: to BOARD or to BCM?
Replies: 6
Views: 2428

Re: RPi.GPIO question: to BOARD or to BCM?

DirkS wrote:In RPi.GPIO the default is BCM
That is incorrect - there is no default. You have to choose GPIO.setmode(GPIO.BCM) or GPIO.setmode(GPIO.BOARD) before running any GPIO code or it will raise an exception.
by croston
Wed Jun 14, 2017 8:23 pm
Forum: Off topic discussion
Topic: python
Replies: 9
Views: 2183

Re: python

Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out. -- G...
by croston
Sun Jun 11, 2017 4:14 pm
Forum: Troubleshooting
Topic: Multiprocessing Virtual Environment: import module fails
Replies: 9
Views: 1800

Re: Multiprocessing Virtual Environment: import module fails

You can use sudo with Python virtual environments if you specify the path of the Python interpreter used in your venv. In other words to run your script:

Code: Select all

$ sudo cv/bin/python startScript.py
by croston
Thu Jan 12, 2017 4:13 pm
Forum: General discussion
Topic: Question on GPIO Pins
Replies: 5
Views: 1130

Re: Question on GPIO Pins

RTFM: https://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/ At the end any program, it is good practice to clean up any resources you might have used. This is no different with RPi.GPIO. By returning all channels you have used back to inputs with no pull up/down, you can avoid accidental ...

Go to advanced search