Page 1 of 1

Picamera Python Syntax Error

Posted: Wed Dec 31, 2014 12:00 pm
by muddy1
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

Re: Picamera Python Syntax Error

Posted: Wed Dec 31, 2014 1:44 pm
by DirkS
Which instructions have you used?
If you post code and error messages here, someone may be able to help...

Gr.
Dirk

Re: Picamera Python Syntax Error

Posted: Wed Dec 31, 2014 6:39 pm
by muddy1
I used the instructions from Dave Smith on this site.

Re: Picamera Python Syntax Error

Posted: Wed Dec 31, 2014 7:51 pm
by elParaguayo
Please post your code (in code tags) as it's very difficult to debug a syntax error without seeing the code.

Re: Picamera Python Syntax Error

Posted: Wed Dec 31, 2014 9:53 pm
by DougieLawson
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?

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 8:55 pm
by muddy1
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.

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 9:02 pm
by elParaguayo
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

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 9:17 pm
by DirkS
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

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 9:19 pm
by DougieLawson
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

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 9:32 pm
by muddy1
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`)

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 9:37 pm
by DirkS
Please put your code in block in future. Indentation is essential in Python.

Can you post the exact, full error message.

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 9:39 pm
by DougieLawson
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.

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 9:50 pm
by muddy1
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

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 10:03 pm
by muddy1
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?"

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 10:09 pm
by DirkS
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.

Re: Picamera Python Syntax Error

Posted: Thu Jan 01, 2015 10:10 pm
by DougieLawson
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.