muddy1
Posts: 9
Joined: Thu Dec 27, 2012 10:45 am

Picamera Python Syntax Error

Wed Dec 31, 2014 12:00 pm

Not sure if this is the correct place for this but, all physical connections made and followed the Python instructions but keep getting syntax error with a /. So I deleted the / and everything worked. That is, Picam runs for 5 seconds and takes pic which is saved to file. However when it comes to the next stage of configuring the GPIO`s total mayhem ensues with loads of syntax errors.

Perhaps I ought to explain that I am a complete and total novice and only used to opening the case and pressing a start button LOL. I have tried several times to load the info but always the same errors. I appreciate the time taken to create and put on the site but for someone like myself if I type as per the instructions and it throws up errors I`m well and truly stuffed. Is there an alternative instruction for the Picamera anywhere please?

Happy new year all

Muddy1

DirkS
Posts: 10018
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Picamera Python Syntax Error

Wed Dec 31, 2014 1:44 pm

Which instructions have you used?
If you post code and error messages here, someone may be able to help...

Gr.
Dirk

muddy1
Posts: 9
Joined: Thu Dec 27, 2012 10:45 am

Re: Picamera Python Syntax Error

Wed Dec 31, 2014 6:39 pm

I used the instructions from Dave Smith on this site.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: Picamera Python Syntax Error

Wed Dec 31, 2014 7:51 pm

Please post your code (in code tags) as it's very difficult to debug a syntax error without seeing the code.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
DougieLawson
Posts: 36576
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Picamera Python Syntax Error

Wed Dec 31, 2014 9:53 pm

muddy1 wrote:I used the instructions from Dave Smith on this site.
Hang on, my Google-fu is missing and my crystal ball has gone offline. Who's Dave Smith and what thread were you reading?
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

muddy1
Posts: 9
Joined: Thu Dec 27, 2012 10:45 am

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 8:55 pm

Sorry, Dave Jones not Smith. Bit more than a typo. I took the info from this site, sorry no idea what is meant by code tags. Mind you I have now moved on to adding a wireless adaptor and I can`t describe the trouble I`m in now. Probably best now to start the OS all over again.

Can someone please advise a book or download with Python for absolute beginners or before beginners.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 9:02 pm

muddy1 wrote: sorry no idea what is meant by code tags.
Have a look at the sticky at the top of this forum: http://www.raspberrypi.org/forums/viewt ... 32&t=84477
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

DirkS
Posts: 10018
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 9:17 pm

muddy1 wrote:Can someone please advise a book or download with Python for absolute beginners or before beginners.
See http://www.raspberrypi.org/forums/viewt ... 32&t=95257

User avatar
DougieLawson
Posts: 36576
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 9:19 pm

If you don't post a link to Dave's code (whether he's a Smith or a Jones or some other western alias) we can't help you.

If you want to learn Python start here http://learnpythonthehardway.org
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

muddy1
Posts: 9
Joined: Thu Dec 27, 2012 10:45 am

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 9:32 pm

Info taken from Resources - Python Camera

import time
import picamera

with picamera.PiCamera() as camera:
camera.start_preview()
time.sleep(5)
camera.capture('/home/pi/Desktop/image.jpg')
camera.stop_preview()

It`s the first/ in the line "camera.capture(`/home/pi/Desktop/image.jpg`)

DirkS
Posts: 10018
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 9:37 pm

Please put your code in block in future. Indentation is essential in Python.

Can you post the exact, full error message.

User avatar
DougieLawson
Posts: 36576
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 9:39 pm

Are you logged in as user pi?
Does /home/pi exist?
Can the id you're using write to /home/pi?

Open a terminal window and try this command
touch /home/pi/foo && rm /home/pi/foo
what results do you get from that?

Also try
whoami
and report back with the results from that one too.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

muddy1
Posts: 9
Joined: Thu Dec 27, 2012 10:45 am

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 9:50 pm

Thanks Gents, I now won`t have a chance to try again until Saturday.

Really appreciate the assistance. Will try to follow ref for including Python text.

Kind regards

Cedric

muddy1
Posts: 9
Joined: Thu Dec 27, 2012 10:45 am

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 10:03 pm

Hi folk

Sorry for the ignorance. I had a look at the sticky ref the code tags and still can`t make heads or tails of it. Where on erth is the "Code Button?"

DirkS
Posts: 10018
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 10:09 pm

muddy1 wrote:Hi folk

Sorry for the ignorance. I had a look at the sticky ref the code tags and still can`t make heads or tails of it. Where on erth is the "Code Button?"
When you're adding / editing a post here on the forum you should see several buttons (probably at the top).
The 'code' button (maybe just a link' will insert a code block.

User avatar
DougieLawson
Posts: 36576
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Picamera Python Syntax Error

Thu Jan 01, 2015 10:10 pm

When you write a post on here there's a line of buttons
labeled: B i u Quote Code List List= [*] Img URL
just above the box you write the text in.

Draw a box around your code by dragging your mouse over it then click the mouse on the Code button.

That wraps your program snippet in [code]...[/code] tags and the forum software does some magic when it displays your posting.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Python”