Go to advanced search

by ben_nuttall
Thu Mar 07, 2019 4:37 pm
Forum: Python
Topic: @property
Replies: 7
Views: 613

Re: @property

That example is a pattern for providing getter/setter with logic but you're saving the value in a "private" attribute with the same name. I say "private" because it's not really private, they could still write to it with f._foo = "blah" but the public API is given as f.foo. Without using _foo: @prop...
by ben_nuttall
Wed Mar 06, 2019 10:20 pm
Forum: Python
Topic: @property
Replies: 7
Views: 613

Re: @property

You can think of properties as attributes with calculated values and custom rules for what they can be (or what happens when they're set). When you typed a.foo when it wasn't a property, it was a method. You call methods with brackets, so a.foo() would have returned 'bar'. Here is a class with a foo...
by ben_nuttall
Mon Feb 25, 2019 5:43 pm
Forum: Python
Topic: GPIOZero, tkinter and is_pressed
Replies: 3
Views: 360

Re: GPIOZero, tkinter and is_pressed

I added code tags to your post but the indentation is still all broken, please indent properly so we can read it. You code includes: while True: button.is_pressed = increment but that doesn't make sense. What do you expect it to do? You might find it easier to use guizero instead of tk. Here's a gui...
by ben_nuttall
Tue Feb 12, 2019 9:22 pm
Forum: Python
Topic: terribly messed up pip and pip3
Replies: 14
Views: 2363

Re: terribly messed up pip and pip3

Download Stretch, upgrade to Buster, start from there. You'll find it much easier, and surely you've got nothing to lose on the old Jessie card?
by ben_nuttall
Mon Feb 11, 2019 10:55 am
Forum: Python
Topic: terribly messed up pip and pip3
Replies: 14
Views: 2363

Re: terribly messed up pip and pip3

So you're on an old OS but want brand new Python? Why do you need Python 3.7? And how did you install it? You can't expect system pip to work with a non-system Python. If you can get Python 3.7 working, you'll definitely need to use "python3.7 get-pip.py" to install pip. I'd really recommend you upg...
by ben_nuttall
Sun Feb 10, 2019 1:22 pm
Forum: Python
Topic: terribly messed up pip and pip3
Replies: 14
Views: 2363

Re: terribly messed up pip and pip3

Where did you get the SD card image from? Did you buy it pre-installed, or did you write the Raspbian image yourself? You're on an old version (Jessie) not the latest version (Stretch). You could download the latest image and write that to your card if you wanted to. Is Python itself working? Type "...
by ben_nuttall
Fri Jan 04, 2019 11:46 am
Forum: Python
Topic: piwheels saved users 39 years of build time in 2018
Replies: 0
Views: 181

piwheels saved users 39 years of build time in 2018

In 2018, a total of 5,154,233 packages were downloaded from piwheels.org, saving users 39 years, 10 months and 29 days. Some more stats for the year: - Average daily downloads: 14,519 - Average monthly downloads: 429,519 - Most downloads in one day: 25,389 on 30 November - Most downloads in one mont...
by ben_nuttall
Mon Nov 19, 2018 1:17 pm
Forum: Troubleshooting
Topic: Errors with simple Pi Camera code (RPIO, RPi.GPIO) - gpiozero fix issues?
Replies: 2
Views: 495

Re: Errors with simple Pi Camera code (RPIO, RPi.GPIO) - gpiozero fix issues?

The bug brought into RPi.GPIO 0.6.4 has been fixed and 0.6.5 is now released into Raspbian. If you installed the temporary fix, uninstall it and install the latest version: sudo pip uninstall rpi.gpio -y sudo pip3 uninstall rpi.gpio -y sudo apt update sudo apt install python3-rpi.gpio python-rpi.gpi...
by ben_nuttall
Thu Sep 27, 2018 9:58 pm
Forum: Beginners
Topic: Installing numpy python3
Replies: 6
Views: 25929

Re: Installing numpy python3

It's not very clear but this shows that a shared object file is missing. The numpy you get from piwheels depends on libatlas. When installing numpy using pip, you also need to install libatlas3-base: sudo apt install libatlas3-base sudo pip3 install numpy I wrote about this process on the piwheels b...
by ben_nuttall
Thu Jan 11, 2018 2:03 pm
Forum: Troubleshooting
Topic: Resetting gpiozero Button using pin_factory hangs code after connection failure
Replies: 4
Views: 755

Re: Resetting gpiozero Button using pin_factory hangs code after connection failure

This is s known problem with pigpio which we hope to fix in gpiozero. See https://github.com/RPi-Distro/python-gpiozero/issues/516 I think you could solve this by recreating your objects in the try/except block. I think this would work, but I haven't tested it: while True: try: with Button(26, pin_f...
by ben_nuttall
Tue Nov 07, 2017 3:24 pm
Forum: User groups and events
Topic: How many Code Clubs are there in South Africa and where are they held?
Replies: 1
Views: 1806

Re: How many Code Clubs are there in South Africa and where are they held?

According to https://www.codeclubworld.org/ there are 32 clubs in South Africa:
Screenshot from 2017-11-07 15-22-48.png
Screenshot from 2017-11-07 15-22-48.png (10.85 KiB) Viewed 1620 times

Just enter the country name in the field and it tells you about the activity in that country.
by ben_nuttall
Mon Nov 06, 2017 3:23 pm
Forum: Weather station
Topic: Help with python scratch module
Replies: 13
Views: 3332

Re: Help with python scratch module

Thanks to Ben Croston for pushing out a new release! piwheels picked up the new scratch 1.0.0 release and built it as a wheel so Stretch users will get this now. And the source tarball is still available from PyPI for those not configured to use piwheels. So just "sudo pip3 install scratch" will wor...
by ben_nuttall
Sat Nov 04, 2017 1:02 pm
Forum: Weather station
Topic: Help with python scratch module
Replies: 13
Views: 3332

Re: Help with python scratch module

DougieLawson wrote:
Thu Nov 02, 2017 4:29 pm
viewtopic.php?f=66&t=194886
Unrelated. For some reason it works if you install from piwheels but not from pypi.
by ben_nuttall
Fri Nov 03, 2017 10:44 am
Forum: Raspbian
Topic: /etc/pip.conf is badly broken
Replies: 9
Views: 2440

Re: /etc/pip.conf is badly broken

An issue caused by pip converting . to - when searching for dependencies meant that pip would look in the wrong piwheels directory for packages with . in the name, breaking it. This has been resolved: https://github.com/bennuttall/piwheels/issues/20#issuecomment-340108171 If you find any issues with...
by ben_nuttall
Wed Oct 11, 2017 1:47 pm
Forum: Staffroom, classroom and projects
Topic: My (current) Teacher Wishlist (from a developing country)
Replies: 4
Views: 3311

Re: My (current) Teacher Wishlist (from a developing country)

Database projects - please. Is there a tiny SQL out there that runs on the Pi? We need some great tutorials that start a the beginning. Does anyone make a fairly light-weight DB app with a GUI for Raspbian? I just wrote an article on this: https://opensource.com/article/17/10/set-postgres-database-...
by ben_nuttall
Mon Jul 31, 2017 5:25 pm
Forum: Python
Topic: piwheels: building a faster Python package repository for Raspberry Pi users
Replies: 0
Views: 595

piwheels: building a faster Python package repository for Raspberry Pi users

Something I've been working on for a little while: piwheels. Have you ever run "pip install <package>" and it's been incredibly slow? That's because you have to download and build the source code yourself. However, a solution to this exists: Python wheels is the standard for distributing pre-built P...
by ben_nuttall
Mon Jun 05, 2017 12:08 pm
Forum: User groups and events
Topic: A sign of the times perhaps
Replies: 8
Views: 4396

Re: A sign of the times perhaps

I think it's important that people have some patience and understanding with staff and volunteers in these circumstances. Holding an event just a couple of days after a terrorist attack, they will have been briefed to be on alert and take certain measures to keep the venue safe - not much time for a...
by ben_nuttall
Mon May 29, 2017 9:35 pm
Forum: User groups and events
Topic: A sign of the times perhaps
Replies: 8
Views: 4396

Re: A sign of the times perhaps

I was at the Norwich Jam and was aware of security checking people's bags on entry - which is understandable - but wasn't aware anyone had been refused entry. What was in the bag that they wouldn't allow in?
by ben_nuttall
Wed Apr 12, 2017 3:03 pm
Forum: Staffroom, classroom and projects
Topic: AllseeingPi
Replies: 4
Views: 3825

Re: AllseeingPi

I think that's the issue - you'll need the Python 3 version of PIL. The package is "python3-pil" not "python-pil".
by ben_nuttall
Wed Apr 12, 2017 1:28 pm
Forum: Staffroom, classroom and projects
Topic: AllseeingPi
Replies: 4
Views: 3825

Re: AllseeingPi

It could be one of several things. If you can answer the following questions I'll do what I can to identify the problem. - Which version of Python are you using? (2 or 3) - Are you using Raspbian Jessie? (from raspberrypi.org/downloads) - Has your SD been kept card up-to-date? (regular/recent apt-ge...
by ben_nuttall
Tue Mar 21, 2017 4:46 pm
Forum: General discussion
Topic: Missing web page
Replies: 2
Views: 530

Re: Missing web page

That resource has been superseded by the 'Physical Computing with Python' resource: https://www.raspberrypi.org/learning/physical-computing-with-python/ If you need access to the old resource, you'll find it on GitHub: https://github.com/raspberrypilearning/physical-computing-guide/blob/master/pull_...
by ben_nuttall
Mon Mar 20, 2017 5:12 pm
Forum: Python
Topic: GPIOZero and TKinter.
Replies: 2
Views: 1209

Re: GPIOZero and TKinter.

Already answered, but yeah, I had a similar issue when importing from both gpiozero and kivvy (both also had "Button"). Python lets you choose whether to import the whole library, namespaced, or import bits of it into the global namespace, for example: from gpiozero import Button btn = Button(17) or...
by ben_nuttall
Sun Mar 19, 2017 1:08 am
Forum: Troubleshooting
Topic: gpiozero
Replies: 6
Views: 1283

Re: gpiozero

Oh it looks like you're using Raspbian Wheezy - we upgraded to Raspbian Jessie about 18 months ago: https://www.raspberrypi.org/blog/raspbian-jessie-is-here/ In Wheezy, you had to run your GPIO programs with "sudo", which meant you couldn't execute GPIO commands if you'd opened IDLE from the main me...
by ben_nuttall
Fri Mar 17, 2017 5:55 pm
Forum: Troubleshooting
Topic: gpiozero
Replies: 6
Views: 1283

Re: gpiozero

Is your file called "gpiozero.py"? If so, you'll need to call it something else, and make sure there's no gpiozero.py or gpiozero.pyc in the same directory. Is your loop code indented? It isn't in your post but that might just be because you didn't use code tags. I don't think your problem is either...
by ben_nuttall
Wed Mar 15, 2017 2:31 pm
Forum: Raspbian
Topic: gpiozero on lite
Replies: 2
Views: 653

Re: gpiozero on lite

No - Jessie Lite is intended as a minimal server image. It doesn't come bundled with anything other than the basics - everything else is optional.

To install gpiozero on jessie lite:

Code: Select all

sudo apt install python3-gpiozero python3-rpi.gpio python3-pkg-resources -y

Go to advanced search