Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

whats wrong with my code,ive been stuck at it for a while now.please assist,its giving me a 'unexpected EOF while parsin

import cgi, os import cgitb; cgitb.enable() form = cgi.FieldStorage()

Get filename here.

fileitem = form['filename']

Test if the file was uploaded

if fileitem.filename: # strip leading path from file name to avoid # directory traversal attacks fn = os.path.basename(fileitem.filename) open('/tmp/' + fn, 'wb').write(fileitem.file.read()) message = 'The file "' + fn + '" was uploaded successfully' else: message = 'No file was uploaded' print (""") Content-Type: text/html\n <html> <body> <p>%s</p>

AJ Tran
AJ Tran
Treehouse Teacher

Hi Linos, this will be easier to help you with if you can show us your code with the Markdown syntax:

Code
Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

          ```html
          <p>This is code!</p>
          ```

1 Answer

AJ Tran
STAFF
AJ Tran
Treehouse Teacher

EOF usually means that there is either extra or missing punctuation. Check out how common this problem is for people, and what else can cause it!

One thing that stands out to me about your code is this statement here:

print(""")

When I run this in my REPL, I get the message:

SyntaxError: EOF while scanning triple-quoted string literal

I hope that this is a good starting point for you!