PDA

View Full Version : Python Help ~ Mandelbrot, The Code Syntax Error



--liger--
10-10-2010, 03:21 PM
Hey everyone,

Right now I'm in terminal programming in the Mandelbrot and MPI codes to create a list of life to compute the life code. Unfortunately I have run into a Syntax error. I'm more than certain it has to do with my raw string code so I'm sure it's an easy fix

bmp.write_image('image.bmp, nx, ny, image, MAX_ITER)
^
SyntaxError: EOL while scanning string literal


That's my error. Here's that line of code:

# convert data to color image and save it in a file
bmp.write_image('image.bmp, nx, ny, image, MAX_ITER)
for w in range(1,mpi.size):
print jobs_completed_by_worker[w],"tasks completed by worker",w

How do I fix that error and is it caused by raw string coding being off???

+Rep for help! :D


**Note the ^ on the error line may not be in the right spot. It should be after the last parentheses.

Jonster
10-10-2010, 07:00 PM
Your best bet would be to head over onto The New Boston (http://www.thenewboston.com/forum/viewforum.php?f=6&sid=6eaa9c188061b7cb14c2e65be56845d9)

Theres a few people on there that will be able to help you out with pretty much anything. Had a few problems with PyQT4 a few times myself etc especially as typically there arent many readily available examples it makes it difficult to problem solve.

LMS16
11-10-2010, 07:03 AM
# convert data to color image and save it in a file
bmp.write_image('image.bmp', nx, ny, image, MAX_ITER)
for w in range(1,mpi.size):
print jobs_completed_by_worker[w],"tasks completed by worker",w

try tht lol i know nothing about python :)

Lew.

Agnostic Bear
11-10-2010, 09:19 AM
('image.bmp

As far as I can see you're missing a '.

LMS16
11-10-2010, 10:42 AM
('image.bmp

As far as I can see you're missing a '.

Thats what I fixed in my code lol. Possibility of a fix?

Lew.

Jonster
11-10-2010, 08:34 PM
It is due to the apostrophee. Just copy in what Lew put and you'll be good to go.

Also you will probably need to indent the print statement depending on if Py2 is similiar to Py3 (I would guess so).

Want to hide these adverts? Register an account for free!