EmmaStaves
Posts: 3
Joined: Wed Apr 12, 2017 9:41 am

AllseeingPi

Wed Apr 12, 2017 9:48 am

Hi,

I thought that it would be good fun to create this with some girls at school but I keep having problems with out of date code etc.

When I run the code the latest problem is that it is unable to locate the PIL?

Can anyone help?

Thanks
Emma

User avatar
ben_nuttall
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 197
Joined: Sun Aug 19, 2012 11:19 am
Location: Cambridge, UK
Contact: Website

Re: AllseeingPi

Wed Apr 12, 2017 1:28 pm

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-get update/upgrade)
Community Manager - Raspberry Pi Foundation
Author of GPIO Zero

PiGraham
Posts: 3272
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: AllseeingPi

Wed Apr 12, 2017 1:41 pm

Did you follow the software installation step?
https://www.raspberrypi.org/learning/th ... /software/

Code: Select all

sudo apt-get install -y python3-picamera python3-pip
sudo pip3 install guizero
sudo pip3 install twython
sudo apt-get install -y python-PIL
There is PIL

User avatar
ben_nuttall
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 197
Joined: Sun Aug 19, 2012 11:19 am
Location: Cambridge, UK
Contact: Website

Re: AllseeingPi

Wed Apr 12, 2017 3:03 pm

I think that's the issue - you'll need the Python 3 version of PIL. The package is "python3-pil" not "python-pil".
Community Manager - Raspberry Pi Foundation
Author of GPIO Zero

Colch
Posts: 1
Joined: Sat Jul 15, 2017 5:06 pm

Re: AllseeingPi

Sat Jul 15, 2017 5:32 pm

Hi Ben, I hope you can help. I am also having problems with PIL.

The first two lines of code are:

Code: Select all

import tkinter as tk
from PIL import ImageTk, Image
The error message is:
Traceback (most recent call last):
File "/home/pi/Camera/new_3.py", line 2, in <module>
from PIL import ImageTk, Image
ImportError: cannot import name 'ImageTk'

PIL does seem to be correctly installed:

Code: Select all

[email protected]:~ $ sudo apt-get install -y python3-picamera python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pip is already the newest version.
python3-picamera is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 103 not upgraded.
[email protected]:~ $ sudo pip3 install guizero
Downloading/unpacking guizero
  Downloading guizero-0.3.3-py3-none-any.whl
Installing collected packages: guizero
Successfully installed guizero
Cleaning up...
[email protected]:~ $ sudo pip3 install twython
Requirement already satisfied (use --upgrade to upgrade): twython in /usr/lib/python3/dist-packages
Cleaning up...
[email protected]:~ $ sudo apt-get install -y python3-PIL
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pil is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 103 not upgraded.

Return to “Staffroom, classroom and projects”

Who is online

Users browsing this forum: No registered users and 2 guests